Fix handling of opclauses in extended statistics
Tomas Vondra <tomas.vondra@postgresql.org>
Fix handling of opclauses in extended statistics We expect opclauses to have exactly one Var and one Const, but the code was checking the Const by calling is_pseudo_constant_clause() which is incorrect - we need a proper constant. Fixed by using plain IsA(x,Const) to check type of the node. We need to do these checks in two places, so move it into a separate function that can be called in both places. Reported by Andreas Seltenreich, based on crash reported by sqlsmith. Backpatch to v12, where this code was introduced. Discussion: https://postgr.es/m/8736jdhbhc.fsf%40ansel.ydns.eu Backpatch-to: 12
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/statistics/extended_stats.c | modified | +64 −12 |
| src/backend/statistics/mcv.c | modified | +7 −20 |
| src/include/statistics/extended_stats_internal.h | modified | +2 −0 |
Discussion
- [sqlsmith] Crash in mcv_get_match_bitmap 19 messages · 2019-07-10 → 2019-07-20