pgsql: Reject oversized MCV lists in pg_restore_extended_stats()

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Reject oversized MCV lists in pg_restore_extended_stats()
Date: 2026-06-16 06:15:32
Message-ID: E1wZN59-000WGn-2i@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Reject oversized MCV lists in pg_restore_extended_stats()

import_mcv(), called by pg_restore_extended_stats(), allowed a list of
MCV items to be larger than the maximum supported when the stats are
loaded back in statext_mcv_deserialize() (STATS_MCVLIST_MAX_ITEMS or 10k
items). A follow-up attempt at loading them would cause a failure,
statext_mcv_deserialize() blocking any attempts.

Attempts at restoring MCV lists too long are now rejected, generating a
WARNING like other inconsistent inputs.

Author: Ewan Young <kdbase(dot)hack(at)gmail(dot)com>
Discussion: https://postgr.es/m/CAON2xHORd2ESXm1KcVeeZ0Kd_aJk4dL4M2WLtzVDM4puaZ-20w@mail.gmail.com

Branch
------
master

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

Modified Files
--------------
src/backend/statistics/extended_stats_funcs.c | 15 +++++++++++++++
src/test/regress/expected/stats_import.out | 19 +++++++++++++++++++
src/test/regress/sql/stats_import.sql | 14 ++++++++++++++
3 files changed, 48 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Heikki Linnakangas 2026-06-16 06:37:31 pgsql: Fix int32 overflow in ltree_compare()
Previous Message David Rowley 2026-06-16 01:43:35 pgsql: Fix various query jumble comments