agora inbox for [email protected]  
help / color / mirror / Atom feed
Re: Revised Copyright: is this more palatable?
972+ messages / 6 participants
[nested] [flat]

* Re: Revised Copyright: is this more palatable?
@ 2000-07-04 16:23  John Daniels <[email protected]>
  0 siblings, 1 reply; 972+ messages in thread

From: John Daniels @ 2000-07-04 16:23 UTC (permalink / raw)
  To: [email protected]; +Cc: [email protected]; pgsql-hackers

Hi:

Several people have complained about forking from the BSD license.  If the 
BSD license is so flawed, why not open the discussion to FreeBSD and other 
BSD license users.  If the license truely is flawed, it can be "fixed" for 
all.  Then no one can claim: 1) a PostgreSQL fork, 2) kow tow to corporate 
interests.

People joining this discussion have varying levels of legal knowledge. It 
seems that some clarification by a legal expert on many of these issues is 
needed.  And knowing the variability of "expertise" in the legal profession, 
and the importance of the issue, I'd recommend a second or third opinion 
(opening the discusion as above could help with this).

John

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com




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

* Re: [HACKERS] Re: Revised Copyright: is this more palatable?
@ 2000-07-06 01:11  Jim Wise <[email protected]>
  parent: John Daniels <[email protected]>
  0 siblings, 1 reply; 972+ messages in thread

From: Jim Wise @ 2000-07-06 01:11 UTC (permalink / raw)
  To: John Daniels <[email protected]>; +Cc: [email protected]; [email protected]; pgsql-hackers

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, 4 Jul 2000, John Daniels wrote:

>Several people have complained about forking from the BSD license.  If the 
>BSD license is so flawed, why not open the discussion to FreeBSD and other 
>BSD license users.  If the license truely is flawed, it can be "fixed" for 
>all.  Then no one can claim: 1) a PostgreSQL fork, 2) kow tow to corporate 
>interests.
>
>People joining this discussion have varying levels of legal knowledge. It 
>seems that some clarification by a legal expert on many of these issues is 
>needed.  And knowing the variability of "expertise" in the legal profession, 
>and the importance of the issue, I'd recommend a second or third opinion 
>(opening the discusion as above could help with this).

One question has been asked several times in this thread, and not,
AFAICT, answered:

What is wrong with the current license?

It's that simple.  What's wrong with the current license?

I'd like to point out a couple things that are _not_ wrong with the
current license:

1.) With the current license, contributors to the code are not opened
    to legal liability for the code they contribute.  The BSD license
    very clearly disclaims all warranty on the part of not only UCB but
    also all contributors

2.) The current license does not interfere with commercial products
    based on PostgreSQL.  To pick a solid example of this, NCOS is an
    almost direct port of NetBSD 1.3 to various `thin client' hardware.
    Each year, IBM, Oracle, and NCI sell thousands of copies of this
    software.  In addition to the great ease with which NetBSD can be
    customized to a specific purpose or ported to new hardware, a key
    reason that NetBSD was chosen over Linux was that if they spend a
    lot of money improving it, they can profit by their work if they
    see fit to.

    Remember, in the end that's what its all about, isn't it?  We _want_
    people to use PostgreSQL...

3.) The current license does not prevent these companies from
    contributing back.  IBM, for example, is preparing to donate back
    a lot of the work they did to make NetBSD run on their (PowerPC
    based) thin client systems.

4.) The current license does not interfere with PostgreSQL being used
    with products under other license.  Look at all the claims that KDE
    is violating the GPL.  Why?  Because its authors put a hell of a lot
    of work into releasing a huge piece of software under GPL, but God
    forbid, some of the other code they used was not GPL'ed...

In short, there is only one thing that people are accusing the BSD
license of not being which it in fact is not:  it is not the GPL.

It may in fact be that the goals and ideology of the PostgreSQL project
have changed so drastically that a move from a BSD license to a GPL is
in tune with the project's desires.  If so, fine, but let's not claim
that this is `fixing' the license, or `furthering the purposes
originally set out by the PostgreSQL project'.  This would be a change
in those goals, and not one which should take place without consensus
among those who have worked so hard on it.

That's my 2 cents.  I'm a user of Postgres, not a developer, so I'll
shut up now :-) 

- --
				Jim Wise
				[email protected]

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 5.0i for non-commercial use
Charset: noconv

iQA/AwUBOWPc0y2NgFbJL33VEQIsiQCfWAZuaYbXZu6X3xvYo8e2D/vtcCwAnAhN
BsRLhw1ninosT/ytRYlBYVDP
=3NDF
-----END PGP SIGNATURE-----




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

* Re: [HACKERS] Re: Revised Copyright: is this more palatable?
@ 2000-07-06 02:13  The Hermit Hacker <[email protected]>
  parent: Jim Wise <[email protected]>
  0 siblings, 1 reply; 972+ messages in thread

From: The Hermit Hacker @ 2000-07-06 02:13 UTC (permalink / raw)
  To: Jim Wise <[email protected]>; +Cc: John Daniels <[email protected]>; [email protected]; pgsql-hackers

On Wed, 5 Jul 2000, Jim Wise wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On Tue, 4 Jul 2000, John Daniels wrote:
> 
> >Several people have complained about forking from the BSD license.  If the 
> >BSD license is so flawed, why not open the discussion to FreeBSD and other 
> >BSD license users.  If the license truely is flawed, it can be "fixed" for 
> >all.  Then no one can claim: 1) a PostgreSQL fork, 2) kow tow to corporate 
> >interests.
> >
> >People joining this discussion have varying levels of legal knowledge. It 
> >seems that some clarification by a legal expert on many of these issues is 
> >needed.  And knowing the variability of "expertise" in the legal profession, 
> >and the importance of the issue, I'd recommend a second or third opinion 
> >(opening the discusion as above could help with this).
> 
> One question has been asked several times in this thread, and not,
> AFAICT, answered:
> 
> What is wrong with the current license?
> 
> It's that simple.  What's wrong with the current license?
> 
> I'd like to point out a couple things that are _not_ wrong with the
> current license:
> 
> 1.) With the current license, contributors to the code are not opened
>     to legal liability for the code they contribute.  The BSD license
>     very clearly disclaims all warranty on the part of not only UCB but
>     also all contributors

Actually, this is the only thing that I do feel the current license is
missing ... unless I'm reading something wrong, it all focuses on
disclaming "UNIVERSITY OF CALIFORNIA"s liability ... that one is very
specific ...





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

* Re: [HACKERS] Re: Revised Copyright: is this more palatable?
@ 2000-07-06 15:55  Richard Poole <[email protected]>
  parent: The Hermit Hacker <[email protected]>
  0 siblings, 1 reply; 972+ messages in thread

From: Richard Poole @ 2000-07-06 15:55 UTC (permalink / raw)
  To: [email protected]; +Cc: The Hermit Hacker <[email protected]>

On Wed, Jul 05, 2000 at 11:13:45PM -0300, The Hermit Hacker wrote:
> On Wed, 5 Jul 2000, Jim Wise wrote:
> 
> > I'd like to point out a couple things that are _not_ wrong with the
> > current license:
> > 
> > 1.) With the current license, contributors to the code are not opened
> >     to legal liability for the code they contribute.  The BSD license
> >     very clearly disclaims all warranty on the part of not only UCB but
> >     also all contributors
> 
> Actually, this is the only thing that I do feel the current license is
> missing ... unless I'm reading something wrong, it all focuses on
> disclaming "UNIVERSITY OF CALIFORNIA"s liability ... that one is very
> specific ...

Since no-one else has mentioned this yet, I will: the Postgres license,
i.e., the file COPYRIGHT at the top level of the distribution, isn't
exactly identical to what's commonly known as "the BSD license". The
Postgres copyright, the BSD 4.4 copyright 
(http://www.freebsd.org/copyright/license.html), and the FreeBSD copyright
(http://www.freebsd.org/copyright/freebsd-license.html), are all
differently worded in parts, although clearly the same in intent. The
latter is almost identical to the BSD license template at
http://www.opensource.org/licenses/bsd-license.html . All of them
except ours say something like "REGENTS AND CONTRIBUTORS" when they're
disclaiming warranties; we just have the University of California doing
so.

The simplest way to change our license if we want to make sure that
it explicitly disclaims warranties on behalf of all contributors seems
to be to add to the existing California paragraphs a dead standard
BSD license with our contributors referred to collectively, which is
what Marc has proposed. There may be people who for one reason or
another (usually US law, as far as I can see) would like to see more
changes, but I can't see what's objectionable about this one.

Richard



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

* Re: [HACKERS] Re: Revised Copyright: is this more palatable?
@ 2000-07-06 16:19  The Hermit Hacker <[email protected]>
  parent: Richard Poole <[email protected]>
  0 siblings, 1 reply; 972+ messages in thread

From: The Hermit Hacker @ 2000-07-06 16:19 UTC (permalink / raw)
  To: Richard Poole <[email protected]>; +Cc: [email protected]

On Thu, 6 Jul 2000, Richard Poole wrote:

> On Wed, Jul 05, 2000 at 11:13:45PM -0300, The Hermit Hacker wrote:
> > On Wed, 5 Jul 2000, Jim Wise wrote:
> > 
> > > I'd like to point out a couple things that are _not_ wrong with the
> > > current license:
> > > 
> > > 1.) With the current license, contributors to the code are not opened
> > >     to legal liability for the code they contribute.  The BSD license
> > >     very clearly disclaims all warranty on the part of not only UCB but
> > >     also all contributors
> > 
> > Actually, this is the only thing that I do feel the current license is
> > missing ... unless I'm reading something wrong, it all focuses on
> > disclaming "UNIVERSITY OF CALIFORNIA"s liability ... that one is very
> > specific ...
> 
> Since no-one else has mentioned this yet, I will: the Postgres license,
> i.e., the file COPYRIGHT at the top level of the distribution, isn't
> exactly identical to what's commonly known as "the BSD license". 

	Ya, I just clued into that ... throughout all the discussions, I
never once thought to do a 'cat /usr/src/COPYRIGHT' on my machine :(

> The
> Postgres copyright, the BSD 4.4 copyright 
> (http://www.freebsd.org/copyright/license.html), and the FreeBSD copyright
> (http://www.freebsd.org/copyright/freebsd-license.html), are all
> differently worded in parts, although clearly the same in intent. The
> latter is almost identical to the BSD license template at
> http://www.opensource.org/licenses/bsd-license.html . All of them

Damn, why didn't anyone ever actually look at this stuff before?  And ya,
I'm just as guilty as the rest ...

> The simplest way to change our license if we want to make sure that it
> explicitly disclaims warranties on behalf of all contributors seems to
> be to add to the existing California paragraphs a dead standard BSD
> license with our contributors referred to collectively, which is what
> Marc has proposed. 

Quite frankly, I like the one that OpenSource.Org provides as standard for
BSD License ... it encompasses everything as one Para instead of repeating
things ...

With wu-ftpd, each source file has this included, as well as a line
consisting of "Copyright (c) <YEAR>, <OWNER>" for each developer that did
work in that file ... 

My personal opinion is to replace the BSD License of 1996 with the BSD
License of today (and keep up with changes to it), as it has been adopt'd
by other Open Source Projects ... as is provided on

      http://www.opensource.org/licenses/bsd-license.html

Something nice, simple and industry standard:

======================[ README file ]===============================

PostgreSQL Data Base Management System (formerly known as Postgres95)

This directory contains the _______ release of PostgreSQL, as well as
various post-release patches in the patches directory.  See INSTALL for
the installation notes and HISTORY for the changes.

We also have a WWW home page located at: http://www.postgreSQL.org


=====================[ COPYRIGHT file ]===============================

Copyright (c) 1994-1996, Regents of the University of California
Copyright (c) 1996-2000, various contributors (as identified in HISTORY)
                         (collectively "Contributors")
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

	Redistributions of source code must retain the above copyright
	notice, this list of conditions and the following disclaimer.

	Redistributions in binary form must reproduce the above copyright
	notice, this list of conditions and the following disclaimer in
	the documentation and/or other materials provided with the
	distribution.

	Neither name of the University nor the names of its contributors
	may be used to endorse or promote products derived from this
	software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.

==========================================




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

* Re: [HACKERS] Re: Revised Copyright: is this more palatable?
@ 2000-07-07 05:28  Thomas Lockhart <[email protected]>
  parent: The Hermit Hacker <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Thomas Lockhart @ 2000-07-07 05:28 UTC (permalink / raw)
  To: The Hermit Hacker <[email protected]>; +Cc: Richard Poole <[email protected]>; [email protected]

> My personal opinion is to replace the BSD License of 1996 with the BSD
> License of today (and keep up with changes to it), as it has been adopt'd
> by other Open Source Projects ... as is provided on

We can't do this *exactly*: afaict we will need to ship the original UCB
license along with the new license, since that original license required
that it continue to travel with the code. We can't unilaterally
substitute another, similar, license.

                      - Thomas



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09  Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-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 --
2000-07-04 16:23 Re: Revised Copyright: is this more palatable? John Daniels <[email protected]>
2000-07-06 01:11 ` Jim Wise <[email protected]>
2000-07-06 02:13   ` The Hermit Hacker <[email protected]>
2000-07-06 15:55     ` Richard Poole <[email protected]>
2000-07-06 16:19       ` The Hermit Hacker <[email protected]>
2000-07-07 05:28         ` Thomas Lockhart <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess 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