Reject oversized MCV lists in pg_restore_extended_stats()
Michael Paquier <michael@paquier.xyz>
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.hack@gmail.com> Discussion: https://postgr.es/m/CAON2xHORd2ESXm1KcVeeZ0Kd_aJk4dL4M2WLtzVDM4puaZ-20w@mail.gmail.com
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/statistics/extended_stats_funcs.c | modified | +15 −0 |
| src/test/regress/expected/stats_import.out | modified | +19 −0 |
| src/test/regress/sql/stats_import.sql | modified | +14 −0 |
Discussion
- [PATCH] pg_restore_extended_stats() can store an MCV list that cannot be read back 3 messages · 2026-06-16