Re: Proving IS NOT NULL inference for ScalarArrayOpExpr's

From: James Coleman <jtc331(at)gmail(dot)com>
To: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proving IS NOT NULL inference for ScalarArrayOpExpr's
Date: 2019-01-13 19:12:38
Views: Raw Message | Whole Thread | Download mbox
Lists: pgsql-hackers

On Sat, Jan 12, 2019 at 8:52 PM David Rowley
<david(dot)rowley(at)2ndquadrant(dot)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 Content-Type Size
saop_is_not_null-v3.patch application/octet-stream 5.0 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2019-01-13 19:34:40 Re: Fast path for empty relids in check_outerjoin_delay()
Previous Message Tom Lane 2019-01-13 18:34:57 Re: [PATCH] check for ctags utility in make_ctags