On Sat, Jan 12, 2019 at 8:52 PM David Rowley <david.row...@2ndquadrant.com> wrote: > > Basically, the planner assumes that the WHERE a IS NOT NULL index > implies WHERE b IN(1,...,101), which is definitely not the case. > > Probably your new code needs to be expanded to become: > > if (IsA(clause, ScalarArrayOpExpr)) > { > ScalarArrayOpExpr *saop = (ScalarArrayOpExpr *) clause; > if (op_strict(saop->opno) && > clause_is_strict_for((Node *) linitial(saop->args), subexpr)) > return true; > }
I've updated the code as well as included the sad path test in addition to my original happy path test. Patch v3 attached. James Coleman
saop_is_not_null-v3.patch
Description: Binary data