Re: Proving IS NOT NULL inference for ScalarArrayOpExpr's - Mailing list pgsql-hackers

From James Coleman
Subject Re: Proving IS NOT NULL inference for ScalarArrayOpExpr's
Date
Msg-id CAAaqYe_2h2+Mmw2f1AFzCDo3GnUZ5sHnZrrGkv0T0xdjAu0ZRA@mail.gmail.com
Whole thread Raw
In response to Re: Proving IS NOT NULL inference for ScalarArrayOpExpr's  (David Rowley <david.rowley@2ndquadrant.com>)
Responses Re: Proving IS NOT NULL inference for ScalarArrayOpExpr's  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
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

Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [PATCH] check for ctags utility in make_ctags
Next
From: Tom Lane
Date:
Subject: Re: Fast path for empty relids in check_outerjoin_delay()