From f468c342d813f76ddc4a778cf3d6a5a7d26c184f Mon Sep 17 00:00:00 2001
From: Corey Huinker <corey.huinker@gmail.com>
Date: Sat, 27 Jun 2026 11:39:04 -0400
Subject: [PATCH v2 01/13] Rename relation_stats_argnum enumeriations.

Rename all relation_stats_argnum enumerated names from foo_ARG to
RELARG_foo. This change will help distinguish these values from other
enumerations which will be added in future commits.
---
 src/backend/statistics/relation_stats.c | 56 ++++++++++++-------------
 1 file changed, 28 insertions(+), 28 deletions(-)

diff --git a/src/backend/statistics/relation_stats.c b/src/backend/statistics/relation_stats.c
index d6631e9a9a4..2ff97c0359e 100644
--- a/src/backend/statistics/relation_stats.c
+++ b/src/backend/statistics/relation_stats.c
@@ -36,24 +36,24 @@
 
 enum relation_stats_argnum
 {
-	RELSCHEMA_ARG = 0,
-	RELNAME_ARG,
-	RELPAGES_ARG,
-	RELTUPLES_ARG,
-	RELALLVISIBLE_ARG,
-	RELALLFROZEN_ARG,
-	NUM_RELATION_STATS_ARGS
+	RELARG_SCHEMA = 0,
+	RELARG_RELNAME,
+	RELARG_RELPAGES,
+	RELARG_RELTUPLES,
+	RELARG_RELALLVISIBLE,
+	RELARG_RELALLFROZEN,
+	RELARG_NUM_RELARGS
 };
 
 static struct StatsArgInfo relarginfo[] =
 {
-	[RELSCHEMA_ARG] = {"schemaname", TEXTOID},
-	[RELNAME_ARG] = {"relname", TEXTOID},
-	[RELPAGES_ARG] = {"relpages", INT4OID},
-	[RELTUPLES_ARG] = {"reltuples", FLOAT4OID},
-	[RELALLVISIBLE_ARG] = {"relallvisible", INT4OID},
-	[RELALLFROZEN_ARG] = {"relallfrozen", INT4OID},
-	[NUM_RELATION_STATS_ARGS] = {0}
+	[RELARG_SCHEMA] = {"schemaname", TEXTOID},
+	[RELARG_RELNAME] = {"relname", TEXTOID},
+	[RELARG_RELPAGES] = {"relpages", INT4OID},
+	[RELARG_RELTUPLES] = {"reltuples", FLOAT4OID},
+	[RELARG_RELALLVISIBLE] = {"relallvisible", INT4OID},
+	[RELARG_RELALLFROZEN] = {"relallfrozen", INT4OID},
+	[RELARG_NUM_RELARGS] = {0}
 };
 
 static bool relation_statistics_update(FunctionCallInfo fcinfo);
@@ -85,11 +85,11 @@ relation_statistics_update(FunctionCallInfo fcinfo)
 	int			nreplaces = 0;
 	Oid			locked_table = InvalidOid;
 
-	stats_check_required_arg(fcinfo, relarginfo, RELSCHEMA_ARG);
-	stats_check_required_arg(fcinfo, relarginfo, RELNAME_ARG);
+	stats_check_required_arg(fcinfo, relarginfo, RELARG_SCHEMA);
+	stats_check_required_arg(fcinfo, relarginfo, RELARG_RELNAME);
 
-	nspname = TextDatumGetCString(PG_GETARG_DATUM(RELSCHEMA_ARG));
-	relname = TextDatumGetCString(PG_GETARG_DATUM(RELNAME_ARG));
+	nspname = TextDatumGetCString(PG_GETARG_DATUM(RELARG_SCHEMA));
+	relname = TextDatumGetCString(PG_GETARG_DATUM(RELARG_RELNAME));
 
 	if (RecoveryInProgress())
 		ereport(ERROR,
@@ -101,15 +101,15 @@ relation_statistics_update(FunctionCallInfo fcinfo)
 									  ShareUpdateExclusiveLock, 0,
 									  RangeVarCallbackForStats, &locked_table);
 
-	if (!PG_ARGISNULL(RELPAGES_ARG))
+	if (!PG_ARGISNULL(RELARG_RELPAGES))
 	{
-		relpages = PG_GETARG_UINT32(RELPAGES_ARG);
+		relpages = PG_GETARG_UINT32(RELARG_RELPAGES);
 		update_relpages = true;
 	}
 
-	if (!PG_ARGISNULL(RELTUPLES_ARG))
+	if (!PG_ARGISNULL(RELARG_RELTUPLES))
 	{
-		reltuples = PG_GETARG_FLOAT4(RELTUPLES_ARG);
+		reltuples = PG_GETARG_FLOAT4(RELARG_RELTUPLES);
 		if (reltuples < -1.0)
 		{
 			ereport(WARNING,
@@ -121,15 +121,15 @@ relation_statistics_update(FunctionCallInfo fcinfo)
 			update_reltuples = true;
 	}
 
-	if (!PG_ARGISNULL(RELALLVISIBLE_ARG))
+	if (!PG_ARGISNULL(RELARG_RELALLVISIBLE))
 	{
-		relallvisible = PG_GETARG_UINT32(RELALLVISIBLE_ARG);
+		relallvisible = PG_GETARG_UINT32(RELARG_RELALLVISIBLE);
 		update_relallvisible = true;
 	}
 
-	if (!PG_ARGISNULL(RELALLFROZEN_ARG))
+	if (!PG_ARGISNULL(RELARG_RELALLFROZEN))
 	{
-		relallfrozen = PG_GETARG_UINT32(RELALLFROZEN_ARG);
+		relallfrozen = PG_GETARG_UINT32(RELARG_RELALLFROZEN);
 		update_relallfrozen = true;
 	}
 
@@ -225,11 +225,11 @@ pg_clear_relation_stats(PG_FUNCTION_ARGS)
 Datum
 pg_restore_relation_stats(PG_FUNCTION_ARGS)
 {
-	LOCAL_FCINFO(positional_fcinfo, NUM_RELATION_STATS_ARGS);
+	LOCAL_FCINFO(positional_fcinfo, RELARG_NUM_RELARGS);
 	bool		result = true;
 
 	InitFunctionCallInfoData(*positional_fcinfo, NULL,
-							 NUM_RELATION_STATS_ARGS,
+							 RELARG_NUM_RELARGS,
 							 InvalidOid, NULL, NULL);
 
 	if (!stats_fill_fcinfo_from_arg_pairs(fcinfo, positional_fcinfo,

base-commit: b7e4e3e7fa73458ecca5cd10f341743fd12a4faa
-- 
2.50.1 (Apple Git-155)

