Re: Proving IS NOT NULL inference for ScalarArrayOpExpr's
James Coleman <jtc331@gmail.com>
From: James Coleman <jtc331@gmail.com>
To: David Rowley <david.rowley@2ndquadrant.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2019-01-13T19:12:38Z
Lists: pgsql-hackers
Attachments
- saop_is_not_null-v3.patch (application/octet-stream) patch v3
On Sat, Jan 12, 2019 at 8:52 PM David Rowley
<david.rowley@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
Commits
-
Teach optimizer's predtest.c more things about ScalarArrayOpExpr.
- 65ce07e0202f 12.0 landed