From 4829e3f64b9ad58cc39979e9dd0671f6c3a083df Mon Sep 17 00:00:00 2001 From: Tomas Vondra Date: Wed, 4 Mar 2020 15:57:09 +0100 Subject: [PATCH 04/11] Fix handling of ScalarArrayOpExpr with ALL clause Simply reject all ALL cases, irrespectedly of the estimation function. --- src/backend/statistics/dependencies.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/backend/statistics/dependencies.c b/src/backend/statistics/dependencies.c index a75b9d73db..72dc1cd1bd 100644 --- a/src/backend/statistics/dependencies.c +++ b/src/backend/statistics/dependencies.c @@ -806,6 +806,15 @@ dependency_is_compatible_clause(Node *clause, Index relid, AttrNumber *attnum) /* If it's an scalar array operator, check for Var IN Const. */ ScalarArrayOpExpr *expr = (ScalarArrayOpExpr *) rinfo->clause; + /* + * Reject ALL() variant, we only care about ANY/IN. + * + * FIXME Maybe we should check if all the values are the same, and + * allow ALL in that case? Doesn't seem very practical, though. + */ + if (!expr->useOr) + return false; + /* Only expressions with two arguments are candidates. */ if (list_length(expr->args) != 2) return false; -- 2.21.1