Re: BUG #19007: Planner fails to choose partial index with spurious 'not null'

Richard Guo <guofenglinux@gmail.com>

From: Richard Guo <guofenglinux@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: bryfox@gmail.com, pgsql-bugs@lists.postgresql.org
Date: 2025-08-04T09:24:37Z
Lists: pgsql-bugs

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Fix const-simplification for index expressions and predicate

  2. Fix const-simplification for constraints and stats

On Mon, Aug 4, 2025 at 2:19 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> (I'm also quite displeased that e2debb643 didn't nuke
> restriction_is_always_true/false.  But that's a separate discussion.)

Hmm, I tried to do that in e2debb643, but failed, as the commit
message explains:

    Note that this patch does not get rid of restriction_is_always_true
    and restriction_is_always_false.  Removing them would prevent us from
    reducing some IS [NOT] NULL quals that we were previously able to
    reduce, because (a) the self-join elimination may introduce new IS NOT
    NULL quals after constant folding, and (b) if some outer joins are
    converted to inner joins, previously irreducible NullTest quals may
    become reducible.

Thanks
Richard