| From: | Michael Paquier <michael(at)paquier(dot)xyz> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Simplify some stats restore code with InputFunctionCallSafe() |
| Date: | 2026-06-29 23:31:09 |
| Message-ID: | E1weLRV-000i5w-2C@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
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(dot)universality(at)gmail(dot)com>
Author: Michael Paquier <michael(at)paquier(dot)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(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Fujii Masao | 2026-06-29 23:53:36 | pgsql: Fix unlogged sequence corruption after standby promotion |
| Previous Message | Bruce Momjian | 2026-06-29 21:38:21 | pgsql: doc PG 19 relnotes: fix autovacuum_vacuum_score_weight prefix |