pgsql: Fix non-bulletproof ScalarArrayOpExpr code for extended statisti
От | Tom Lane |
---|---|
Тема | pgsql: Fix non-bulletproof ScalarArrayOpExpr code for extended statisti |
Дата | |
Msg-id | E1oK1bG-000SXV-R5@gemulon.postgresql.org обсуждение исходный текст |
Список | pgsql-committers |
Fix non-bulletproof ScalarArrayOpExpr code for extended statistics. statext_is_compatible_clause_internal() checked that the arguments of a ScalarArrayOpExpr are one Var and one Const, but it would allow cases where the Const was on the left. Subsequent uses of the clause are not expecting that and would suffer assertion failures or core dumps. mcv.c also had not bothered to cope with the case of a NULL array constant, which seems really unacceptably sloppy of somebody. (Although our tools failed us there too, since AFAIK neither Coverity nor any compiler warned of the obvious use-of-uninitialized-variable condition.) It seems best to handle that by having statext_is_compatible_clause_internal() reject it. Noted while fixing bug #17570. Back-patch to v13 where the extended stats code grew some awareness of ScalarArrayOpExpr. Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/b6d147bcbbf29b7f422f7185192eb57593f3cfc7 Modified Files -------------- src/backend/statistics/extended_stats.c | 12 +++++++++--- src/backend/statistics/mcv.c | 23 ++++++++++------------- src/test/regress/expected/stats_ext.out | 22 ++++++++++++++++++---- src/test/regress/sql/stats_ext.sql | 14 ++++++++++---- 4 files changed, 47 insertions(+), 24 deletions(-)
В списке pgsql-committers по дате отправления: