From 7ce997afd02b3dcaabe103366fe265b7550bfe51 Mon Sep 17 00:00:00 2001 From: Corey Huinker Date: Sun, 28 Jun 2026 16:09:49 -0500 Subject: [PATCH v3 05/15] Make relation_statistics_update stop using fcinfo. Change the function signature of relation_statistics_update to use a NullableDatum array instead of a full FunctionCallInfo. --- src/backend/statistics/relation_stats.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/backend/statistics/relation_stats.c b/src/backend/statistics/relation_stats.c index deac37cbab0..54e8609cba6 100644 --- a/src/backend/statistics/relation_stats.c +++ b/src/backend/statistics/relation_stats.c @@ -61,7 +61,7 @@ static struct StatsArgInfo relarginfo[] = static bool relation_statistics_update(FunctionCallInfo fcinfo); static bool relation_statistics_update_internal(Oid reloid, - FunctionCallInfo fcinfo); + const NullableDatum *args); /* * Internal function for modifying statistics for a relation. @@ -90,14 +90,14 @@ relation_statistics_update(FunctionCallInfo fcinfo) ShareUpdateExclusiveLock, 0, RangeVarCallbackForStats, &locked_table); - return relation_statistics_update_internal(reloid, fcinfo); + return relation_statistics_update_internal(reloid, fcinfo->args); } /* * Workhorse function for relation_statistics_update. */ static bool -relation_statistics_update_internal(Oid reloid, FunctionCallInfo fcinfo) +relation_statistics_update_internal(Oid reloid, const NullableDatum *args) { BlockNumber relpages = 0; bool update_relpages = false; @@ -116,15 +116,15 @@ relation_statistics_update_internal(Oid reloid, FunctionCallInfo fcinfo) int nreplaces = 0; bool result = true; - if (!PG_ARGISNULL(RELARG_RELPAGES)) + if (!args[RELARG_RELPAGES].isnull) { - relpages = PG_GETARG_UINT32(RELARG_RELPAGES); + relpages = DatumGetUInt32(args[RELARG_RELPAGES].value); update_relpages = true; } - if (!PG_ARGISNULL(RELARG_RELTUPLES)) + if (!args[RELARG_RELTUPLES].isnull) { - reltuples = PG_GETARG_FLOAT4(RELARG_RELTUPLES); + reltuples = DatumGetFloat4(args[RELARG_RELTUPLES].value); if (isnan(reltuples) || isinf(reltuples)) { ereport(WARNING, @@ -143,15 +143,15 @@ relation_statistics_update_internal(Oid reloid, FunctionCallInfo fcinfo) update_reltuples = true; } - if (!PG_ARGISNULL(RELARG_RELALLVISIBLE)) + if (!args[RELARG_RELALLVISIBLE].isnull) { - relallvisible = PG_GETARG_UINT32(RELARG_RELALLVISIBLE); + relallvisible = DatumGetUInt32(args[RELARG_RELALLVISIBLE].value); update_relallvisible = true; } - if (!PG_ARGISNULL(RELARG_RELALLFROZEN)) + if (!args[RELARG_RELALLFROZEN].isnull) { - relallfrozen = PG_GETARG_UINT32(RELARG_RELALLFROZEN); + relallfrozen = DatumGetUInt32(args[RELARG_RELALLFROZEN].value); update_relallfrozen = true; } @@ -302,5 +302,5 @@ import_relation_statistics(Relation rel, newfcinfo->args[RELARG_RELALLFROZEN] = *relallfrozen; return relation_statistics_update_internal(RelationGetRelid(rel), - newfcinfo); + newfcinfo->args); } -- 2.50.1 (Apple Git-155)