Re: constraint exclusion and nulls in IN (..) clause - Mailing list pgsql-hackers

From Emre Hasegeli
Subject Re: constraint exclusion and nulls in IN (..) clause
Date
Msg-id CAE2gYzzaemeKJ7WbBt0eR9U-w4v0aDQ-pFNPpEbdRf_dUvMkOw@mail.gmail.com
Whole thread Raw
In response to Re: constraint exclusion and nulls in IN (..) clause  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
Responses Re: constraint exclusion and nulls in IN (..) clause  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
List 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.


pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: ALTER TABLE ADD COLUMN fast default
Next
From: Amit Langote
Date:
Subject: Re: constraint exclusion and nulls in IN (..) clause