agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
pgsql: Simplify some stats restore code with InputFunctionCallSafe()
2+ messages / 1 participants
[nested] [flat]

* pgsql: Simplify some stats restore code with InputFunctionCallSafe()
@ 2026-06-29 23:31 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Paquier @ 2026-06-29 23:31 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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
------
master

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

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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Simplify some stats restore code with InputFunctionCallSafe()
@ 2026-06-29 23:31 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Paquier @ 2026-06-29 23:31 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2026-06-29 23:31 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-06-29 23:31 pgsql: Simplify some stats restore code with InputFunctionCallSafe() Michael Paquier <michael@paquier.xyz>
2026-06-29 23:31 pgsql: Simplify some stats restore code with InputFunctionCallSafe() Michael Paquier <michael@paquier.xyz>

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