v2-0011-Rename-attribute_statistics_update.patch

application/octet-stream

Filename: v2-0011-Rename-attribute_statistics_update.patch
Type: application/octet-stream
Part: 12
Message: Re: use of SPI by postgresImportForeignStatistics

Patch

Format: format-patch
Series: patch v2-0011
Subject: Rename attribute_statistics_update.
File+
src/backend/statistics/attribute_stats.c 6 6
From dee30704ded4a30a34d8e3e7069b51693f1b9f75 Mon Sep 17 00:00:00 2001
From: Corey Huinker <corey.huinker@gmail.com>
Date: Sun, 28 Jun 2026 22:10:06 -0500
Subject: [PATCH v2 11/13] Rename attribute_statistics_update.

Rename attribute_statistics_update and attribute_stats_argnum.  This
allows us to create a public function of the same name but a slightly
different purpose.

Rename attribute_stats_argnum to attribute_args_argnum and
clear_attribute_stats_argnum to clear_attribute_args_argnum because they
cover all parameters for pg_restore_attribute_stats and
pg_clear_attribute_stats respectively, not just the statistical ones.

These changes make way for publicly visible enums of the same names that
contain only the statistical columns.
---
 src/backend/statistics/attribute_stats.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/backend/statistics/attribute_stats.c b/src/backend/statistics/attribute_stats.c
index 260e5bb1d48..24c3204e837 100644
--- a/src/backend/statistics/attribute_stats.c
+++ b/src/backend/statistics/attribute_stats.c
@@ -32,10 +32,10 @@
 
 /*
  * Positional argument numbers, names, and types for
- * attribute_statistics_update() and pg_restore_attribute_stats().
+ * update_attstats() and pg_restore_attribute_stats().
  */
 
-enum attribute_stats_argnum
+enum attribute_args_argnum
 {
 	ATTARG_ATTRELSCHEMA = 0,
 	ATTARG_ATTRELNAME,
@@ -86,7 +86,7 @@ static struct StatsArgInfo attarginfo[] =
  * pg_clear_attribute_stats().
  */
 
-enum clear_attribute_stats_argnum
+enum clear_attribute_args_argnum
 {
 	C_ATTARG_ATTRELSCHEMA = 0,
 	C_ATTARG_ATTRELNAME,
@@ -104,7 +104,7 @@ static struct StatsArgInfo cleararginfo[] =
 	[C_ATTARG_NUM_ATTARGS] = {0}
 };
 
-static bool attribute_statistics_update(const NullableDatum *args);
+static bool update_attstats(const NullableDatum *args);
 static void upsert_pg_statistic(Relation starel, HeapTuple oldtup,
 								const Datum *values, const bool *nulls, const bool *replaces);
 static bool delete_pg_statistic(Oid reloid, AttrNumber attnum, bool stainherit);
@@ -126,7 +126,7 @@ static bool delete_pg_statistic(Oid reloid, AttrNumber attnum, bool stainherit);
  * and other statistic kinds may still be updated.
  */
 static bool
-attribute_statistics_update(const NullableDatum *args)
+update_attstats(const NullableDatum *args)
 {
 	char	   *nspname;
 	char	   *relname;
@@ -680,7 +680,7 @@ pg_restore_attribute_stats(PG_FUNCTION_ARGS)
 										attarginfo))
 		result = false;
 
-	if (!attribute_statistics_update(positional_args))
+	if (!update_attstats(positional_args))
 		result = false;
 
 	PG_RETURN_BOOL(result);
-- 
2.50.1 (Apple Git-155)