pgsql: Fix handling of nested values in "exprs" for pg_restore_extended

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix handling of nested values in "exprs" for pg_restore_extended
Date: 2026-11-04 01:56:29
Message-ID: E1xOQEo-000000005nl-0WtH@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix handling of nested values in "exprs" for pg_restore_extended_stats()

check_all_expr_argnames_valid() iterated over the keys of each
expression object without skipping nested containers, so an unknown key
whose value is an array or an object broke the expected key/value token
sequence. This caused an assertion failure, or an infinite loop that
cannot be canceled in non-assert builds.

This issue is fixed by skipping any nested containers, as we expect a
single array with a single sets of key/value pairs.

While on it, remove an unused allocation of the invalid key name.
This one has been noticed in passing.

Author: Ilia Evdokimov <ilya(dot)evdokimov(at)tantorlabs(dot)com>
Reviewed-by: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Reviewed-by: Michael Paquier <michael(at)paquier(dot)xyz>
Discussion: https://postgr.es/m/f0034efa-66fb-4963-9872-c089dd021007@tantorlabs.com
Backpatch-through: 19

Branch
------
REL_19_STABLE

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

Modified Files
--------------
src/backend/statistics/extended_stats_funcs.c | 8 ++------
src/test/regress/expected/stats_import.out | 14 ++++++++++++++
src/test/regress/sql/stats_import.sql | 9 +++++++++
3 files changed, 25 insertions(+), 6 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Fujii Masao 2026-11-04 02:20:49 pgsql: Fix memory leaks when freeing WAL readers
Previous Message David Rowley 2026-11-04 00:45:53 pgsql: Fix Memoize to correctly use clause's input collation