From dd204c1fcc6bdec7ba73f55afcb26a3d39c96bd5 Mon Sep 17 00:00:00 2001
From: "Chao Li (Evan)" <lic@highgo.com>
Date: Wed, 22 Apr 2026 11:33:16 +0800
Subject: [PATCH v1] Cleanup v19 introduced shadow-variable warnings

Suggested-by: David Rowley <dgrowleyml@gmail.com>
Author: Chao Li <lic@highgo.com>
Reviewed-by:
Discussion: https://postgr.es/m/CAEoWx2kQ2x5gMaj8tHLJ3=jfC+p5YXHkJyHrDTiQw2nn2FJTmQ@mail.gmail.com
---
 src/backend/commands/tablecmds.c            | 28 ++++++++++-----------
 src/backend/commands/wait.c                 | 12 ++++-----
 src/backend/postmaster/datachecksum_state.c |  8 +++---
 src/bin/pg_dump/pg_dumpall.c                | 26 +++++++++----------
 src/bin/psql/describe.c                     | 12 ++++-----
 5 files changed, 43 insertions(+), 43 deletions(-)

diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 1068d7c7b6a..ec8207687c0 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -22610,7 +22610,7 @@ createTableConstraints(List **wqueue, AlteredTableInfo *tab,
 		bool		ccvalid = constr->check[ccnum].ccvalid;
 		Node	   *ccbin_node;
 		bool		found_whole_row;
-		Constraint *constr;
+		Constraint *con;
 
 		/*
 		 * The partitioned table can not have a NO INHERIT check constraint
@@ -22632,19 +22632,19 @@ createTableConstraints(List **wqueue, AlteredTableInfo *tab,
 				 ccname,
 				 RelationGetRelationName(parent_rel));
 
-		constr = makeNode(Constraint);
-		constr->contype = CONSTR_CHECK;
-		constr->conname = pstrdup(ccname);
-		constr->deferrable = false;
-		constr->initdeferred = false;
-		constr->is_enforced = ccenforced;
-		constr->skip_validation = !ccvalid;
-		constr->initially_valid = ccvalid;
-		constr->is_no_inherit = ccnoinherit;
-		constr->raw_expr = NULL;
-		constr->cooked_expr = nodeToString(ccbin_node);
-		constr->location = -1;
-		constraints = lappend(constraints, constr);
+		con = makeNode(Constraint);
+		con->contype = CONSTR_CHECK;
+		con->conname = pstrdup(ccname);
+		con->deferrable = false;
+		con->initdeferred = false;
+		con->is_enforced = ccenforced;
+		con->skip_validation = !ccvalid;
+		con->initially_valid = ccvalid;
+		con->is_no_inherit = ccnoinherit;
+		con->raw_expr = NULL;
+		con->cooked_expr = nodeToString(ccbin_node);
+		con->location = -1;
+		constraints = lappend(constraints, con);
 	}
 
 	/* Install all CHECK constraints. */
diff --git a/src/backend/commands/wait.c b/src/backend/commands/wait.c
index 382d5c2d44f..7fe53a6f045 100644
--- a/src/backend/commands/wait.c
+++ b/src/backend/commands/wait.c
@@ -92,7 +92,7 @@ ExecWaitStmt(ParseState *pstate, WaitStmt *stmt, bool isTopLevel,
 		{
 			char	   *timeout_str;
 			const char *hintmsg;
-			double		result;
+			double		val;
 
 			if (timeout_specified)
 				errorConflictingDefElem(defel, pstate);
@@ -100,7 +100,7 @@ ExecWaitStmt(ParseState *pstate, WaitStmt *stmt, bool isTopLevel,
 
 			timeout_str = defGetString(defel);
 
-			if (!parse_real(timeout_str, &result, GUC_UNIT_MS, &hintmsg))
+			if (!parse_real(timeout_str, &val, GUC_UNIT_MS, &hintmsg))
 			{
 				ereport(ERROR,
 						errcode(ERRCODE_INVALID_PARAMETER_VALUE),
@@ -113,20 +113,20 @@ ExecWaitStmt(ParseState *pstate, WaitStmt *stmt, bool isTopLevel,
 			 * don't fail on just-out-of-range values that would round into
 			 * range.
 			 */
-			result = rint(result);
+			val = rint(val);
 
 			/* Range check */
-			if (unlikely(isnan(result) || !FLOAT8_FITS_IN_INT64(result)))
+			if (unlikely(isnan(val) || !FLOAT8_FITS_IN_INT64(val)))
 				ereport(ERROR,
 						errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
 						errmsg("timeout value is out of range"));
 
-			if (result < 0)
+			if (val < 0)
 				ereport(ERROR,
 						errcode(ERRCODE_INVALID_PARAMETER_VALUE),
 						errmsg("timeout cannot be negative"));
 
-			timeout = (int64) result;
+			timeout = (int64) val;
 		}
 		else if (strcmp(defel->defname, "no_throw") == 0)
 		{
diff --git a/src/backend/postmaster/datachecksum_state.c b/src/backend/postmaster/datachecksum_state.c
index b3e99170669..9f9a2f9c40e 100644
--- a/src/backend/postmaster/datachecksum_state.c
+++ b/src/backend/postmaster/datachecksum_state.c
@@ -546,7 +546,7 @@ StartDataChecksumsWorkerLauncher(DataChecksumsWorkerOperation op,
 {
 	BackgroundWorker bgw;
 	BackgroundWorkerHandle *bgw_handle;
-	bool		launcher_running;
+	bool		is_running;
 	DataChecksumsWorkerOperation launcher_running_op;
 
 #ifdef USE_ASSERT_CHECKING
@@ -565,8 +565,8 @@ StartDataChecksumsWorkerLauncher(DataChecksumsWorkerOperation op,
 	DataChecksumState->launch_cost_limit = cost_limit;
 
 	/* Is the launcher already running? If so, what is it doing? */
-	launcher_running = DataChecksumState->launcher_running;
-	if (launcher_running)
+	is_running = DataChecksumState->launcher_running;
+	if (is_running)
 		launcher_running_op = DataChecksumState->operation;
 
 	LWLockRelease(DataChecksumsWorkerLock);
@@ -589,7 +589,7 @@ StartDataChecksumsWorkerLauncher(DataChecksumsWorkerOperation op,
 	 * already in the desired state, i.e. if the checksums are already enabled
 	 * and you call pg_enable_data_checksums().
 	 */
-	if (!launcher_running)
+	if (!is_running)
 	{
 		/*
 		 * Prepare the BackgroundWorker and launch it.
diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c
index 9e904f76baa..847310f258d 100644
--- a/src/bin/pg_dump/pg_dumpall.c
+++ b/src/bin/pg_dump/pg_dumpall.c
@@ -83,7 +83,7 @@ static void buildShSecLabels(PGconn *conn,
 							 PQExpBuffer buffer);
 static void executeCommand(PGconn *conn, const char *query);
 static void check_for_invalid_global_names(PGconn *conn,
-										   SimpleStringList *database_exclude_names);
+										   SimpleStringList *db_exclude_names);
 static void expand_dbname_patterns(PGconn *conn, SimpleStringList *patterns,
 								   SimpleStringList *names);
 static void read_dumpall_filters(const char *filename, SimpleStringList *pattern);
@@ -2269,7 +2269,7 @@ executeCommand(PGconn *conn, const char *query)
  */
 static void
 check_for_invalid_global_names(PGconn *conn,
-							   SimpleStringList *database_exclude_names)
+							   SimpleStringList *db_exclude_names)
 {
 	PGresult   *res;
 	int			i;
@@ -2296,7 +2296,7 @@ check_for_invalid_global_names(PGconn *conn,
 
 		/* Skip excluded databases since they won't be in map.dat */
 		if (strcmp(objtype, "database") == 0 &&
-			simple_string_list_member(database_exclude_names, objname))
+			simple_string_list_member(db_exclude_names, objname))
 			continue;
 
 		if (strpbrk(objname, "\n\r"))
@@ -2406,29 +2406,29 @@ read_dumpall_filters(const char *filename, SimpleStringList *pattern)
 static ArchiveFormat
 parseDumpFormat(const char *format)
 {
-	ArchiveFormat archDumpFormat;
+	ArchiveFormat archFormat;
 
 	if (pg_strcasecmp(format, "c") == 0)
-		archDumpFormat = archCustom;
+		archFormat = archCustom;
 	else if (pg_strcasecmp(format, "custom") == 0)
-		archDumpFormat = archCustom;
+		archFormat = archCustom;
 	else if (pg_strcasecmp(format, "d") == 0)
-		archDumpFormat = archDirectory;
+		archFormat = archDirectory;
 	else if (pg_strcasecmp(format, "directory") == 0)
-		archDumpFormat = archDirectory;
+		archFormat = archDirectory;
 	else if (pg_strcasecmp(format, "p") == 0)
-		archDumpFormat = archNull;
+		archFormat = archNull;
 	else if (pg_strcasecmp(format, "plain") == 0)
-		archDumpFormat = archNull;
+		archFormat = archNull;
 	else if (pg_strcasecmp(format, "t") == 0)
-		archDumpFormat = archTar;
+		archFormat = archTar;
 	else if (pg_strcasecmp(format, "tar") == 0)
-		archDumpFormat = archTar;
+		archFormat = archTar;
 	else
 		pg_fatal("unrecognized output format \"%s\"; please specify \"c\", \"d\", \"p\", or \"t\"",
 				 format);
 
-	return archDumpFormat;
+	return archFormat;
 }
 
 /*
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index dd1179ef927..974dbc5ec2c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -1938,7 +1938,7 @@ describeOneTableDetails(const char *schemaname,
 	 */
 	if (tableinfo.relkind == RELKIND_PROPGRAPH)
 	{
-		printQueryOpt myopt = pset.popt;
+		printQueryOpt mypopt = pset.popt;
 		char	   *footers[3] = {NULL, NULL, NULL};
 
 		printfPQExpBuffer(&buf, "/* %s */\n", _("Get property graph information"));
@@ -1993,12 +1993,12 @@ describeOneTableDetails(const char *schemaname,
 			}
 		}
 
-		myopt.footers = footers;
-		myopt.topt.default_footer = false;
-		myopt.title = title.data;
-		myopt.translate_header = true;
+		mypopt.footers = footers;
+		mypopt.topt.default_footer = false;
+		mypopt.title = title.data;
+		mypopt.translate_header = true;
 
-		printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
+		printQuery(res, &mypopt, pset.queryFout, false, pset.logfile);
 
 		free(footers[0]);
 		free(footers[1]);
-- 
2.50.1 (Apple Git-155)

