public inbox for pgsql-committers@postgresql.org
help / color / mirror / Atom feedFrom: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix issues with handling of expressions in extended stats restor
Date: Mon, 18 May 2026 04:18:47 +0000
Message-ID: <E1wOpRH-0006AC-1q@gemulon.postgresql.org> (raw)
Fix issues with handling of expressions in extended stats restore
This commit addresses some defects with the handling of expressions in
pg_restore_extended_stats() and pg_clear_extended_stats():
- Misleading WARNING for an incorrect number of expressions, where the
number of required expressions was reported as the number of elements
given in input rather than the actual number of expressions expected by
the extstats object definition.
- Incorrect matching of expression names, where a key name was
considered as valid as long as it matched with the prefix of a legit key
name. For example "correlatio" given in input would match with
"correlation", and be considered valid. The consequence of this bug was
a silent discard of the input data, where the operation would be
considered a success. The value associated to the prefixed key was not
inserted in the catalogs, just ignored. pg_dump would not generate such
input data patterns, but a user doing manual stats injection could.
- Missing heap_freetuple() in pg_clear_extended_stats(), for the case
where the extstats object in input does not match with its parent
relation.
Author: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/A7C11B83-7534-4A09-9071-FBD09175CFC8@gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/a28fa2947d2a507089605c47bbfa9016d457208c
Modified Files
--------------
src/backend/statistics/extended_stats_funcs.c | 6 +++--
src/test/regress/expected/stats_import.out | 32 +++++++++++++++++++++++++--
src/test/regress/sql/stats_import.sql | 19 +++++++++++++++-
3 files changed, 52 insertions(+), 5 deletions(-)
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: Fix issues with handling of expressions in extended stats restor
In-Reply-To: <E1wOpRH-0006AC-1q@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