Re: constraint exclusion and nulls in IN (..) clause

From: Emre Hasegeli <emre(at)hasegeli(dot)com>
To: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
Cc: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: constraint exclusion and nulls in IN (..) clause
Date: 2018-03-06 09:46:42
Message-ID: CAE2gYzzaemeKJ7WbBt0eR9U-w4v0aDQ-pFNPpEbdRf_dUvMkOw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Patch teaches it to ignore nulls when it's known that the operator being
> used is strict. It is harmless and has the benefit that constraint
> exclusion gives an answer that is consistent with what actually running
> such a qual against a table's rows would do.

Yes, I understood that. I just meant that I don't know if it is the
best way to skip NULLs inside "next_fn". Maybe the caller of the
"next_fn"s should skip them. Anyway, the committer can judge this
better.

> Yeah. Rearranged the code to fix that.

This version looks correct to me.

> + state->next = (state->next != NULL) ? lnext(state->next) : NULL;
> + node = (state->next != NULL) ? lfirst(state->next) : NULL;

I think it is unnecessary to check for (state->next != NULL) two
times. We can put those in a single if.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2018-03-06 10:10:53 Re: constraint exclusion and nulls in IN (..) clause
Previous Message David Rowley 2018-03-06 09:45:43 Re: ALTER TABLE ADD COLUMN fast default