Re: statatt_build_stavalues->LOCAL_FCINFO wrong number

jian he <jian.universality@gmail.com>

From: jian he <jian.universality@gmail.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2026-06-29T11:13:07Z
Lists: pgsql-hackers
On Mon, Jun 29, 2026 at 4:23 PM Michael Paquier <michael@paquier.xyz> wrote:
>
> Thanks for the report.  Will do something for both spots.

checking attribute_stats.c, extended_stats_funcs.c

/*
 * Build an array datum with element type elemtypid from a text datum, used as
 * value of an attribute in a pg_statistic tuple.
 *
 * If an error is encountered, capture it, and reduce the elevel to WARNING.
 *
 * This is an adaptation of statatt_build_stavalues().
 */
static Datum
array_in_safe(FmgrInfo *array_in, const char *s, Oid typid, int32 typmod,
              AttrNumber exprnum, const char *element_name, bool *ok)

/*
 * Build an array with element type elemtypid from a text datum, used as
 * value of an attribute in a tuple to-be-inserted into pg_statistic.
 *
statatt_build_stavalues

"elemtypid" does not appear within the function (mentioned above), so
"elemtypid" comment is wrong?


The general idea is to add a trailing comma to the last field of each enum.
We need to add a comma after the last field in enum attribute_stats_argnum,
clear_attribute_stats_argnum, and extended_stats_exprs_element.



--
jian
https://www.enterprisedb.com/



Commits

  1. Simplify some stats restore code with InputFunctionCallSafe()

  2. Move attribute statistics functions to stat_utils.c