+ if (elem_nulls[i])
+ {
+ nonmcv_cnt--;
+ continue;
+ }
> The patch v8 can still be reviewed as-is, and if the selectivity
> regression test gets committed [0], I will add corresponding tests for
> this change as well.
Without [0], the const path will return incorrect results for <> ALL
and NULLs. Compared to that, the other path still has special handling
in it:
+ /*
+ * For ALL semantics, if the array contains NULL, assume
+ * operator is strict. The ScalarArrayOpExpr cannot
+ * evaluate to TRUE, so return zero.
+ */
+ nonconst_sel = var_eq_non_const(&vardata, operator,
+ clause->inputcollid,
+ other_op, var_on_left,
+ isInequality);
+ if (isInequality)
+ individual_s = 1.0 - individual_s - nullfrac;
Isn't this the double negation issue again, which was once
mentioned/fixed earlier?
+ int count; /* number of occurrences of current value in */
That's a truncated comment