agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Simplify some stats restore code with InputFunctionCallSafe()
Date: Mon, 29 Jun 2026 23:31:09 +0000
Message-ID: <E1weLRV-000i5y-2G@gemulon.postgresql.org> (raw)

Simplify some stats restore code with InputFunctionCallSafe()

statatt_build_stavalues() and array_in_safe() have been relying on
InitFunctionCallInfoData() with a locally-filled state to call a data
type input function.  InputFunctionCallSafe() can be used to achieve the
same job, simplifying some code.

This fixes an over-allocation of FunctionCallInfoBaseData done in
statatt_build_stavalues(), where there was space for 8 elements but only
3 were needed.  The over-allocation exists since REL_18_STABLE, and was
harmless in practice.

While on it, fix some comments for both routines, where elemtypid was
mentioned.

Backpatch down to v19.  This code has been reworked during the last
development cycle while working on the restore of extended statistics,
so this keeps the code consistent across all branches.

Author: Jian He <jian.universality@gmail.com>
Author: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CACJufxEGah9PaiTQ=cG14GMMBsUQ3ohGct9tdSwbMQPQ0-nbbQ@mail.gmail.com
Backpatch-through: 19

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/ac536a4061bcf22db46ba23d077cd36e65e14e1a

Modified Files
--------------
src/backend/statistics/extended_stats_funcs.c | 17 +++--------------
src/backend/statistics/stat_utils.c           | 23 ++++++-----------------
2 files changed, 9 insertions(+), 31 deletions(-)



view thread (2+ messages)

Message-ID: <E1weLRV-000i5y-2G@gemulon.postgresql.org>
Permalink:  ../E1weLRV-000i5y-2G@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1weLRV-000i5y-2G@gemulon.postgresql.org

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Simplify some stats restore code with InputFunctionCallSafe()
  In-Reply-To: <E1weLRV-000i5y-2G@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox