Empty set membership
A set filter with an empty list of values is valid. In matches no row and not in matches every row, including rows whose field is null. The empty list combines with and, or and not by ordinary logic.
Rule. A $defs/setComparisonNode whose values array is empty is valid. in with no values matches no row; notIn with no values matches every row. Both answers hold for rows whose field is NULL or missing: in [] never matches one (SEM-2: in never matches null), and notIn [] matches it, the constant being true for every row, so no IS NULL disjunct is added next to it. The empty list is a constant, so it composes by ordinary Boolean logic inside and, or and not (in [] OR p matches what p matches; notIn [] AND p matches what p matches). The null fan-out of SEM-2 applies at a notNode as ever, so not(in []) matches every row and not(notIn []) matches exactly the rows whose field is NULL or missing. Compilers do not fold the constant out of the tree.
Rendering. The empty list is never sent to the engine as a list.
- SQL:
in []→1 = 0,notIn []→1 = 1, in every dialect (SQL Server and Oracle have no boolean literal in predicate position). NeverIN ()(a syntax error) and never a bound empty array. - MongoDB:
{field: {$in: []}}and{field: {$nin: []}}. No string comparison happens, so no collation is attached for them. - OpenSearch/Elasticsearch:
match_noneandmatch_all.
Origin. AG Grid's Set Filter sends {filterType: "set", values: []} when the user clears every value, and its own client-side row model then shows no rows. Rejecting the request would make every host re-implement that rule. A null "(Blanks)" element inside values is a different matter and stays rejected.
Must NOT. Emit IN () or bind an empty array; add an IS NULL disjunct next to the constant itself; reject the request; fold the constant out of the tree.
Cross-links. $defs/setComparisonNode, SEM-2 (null handling), SQL-4 (typed set arrays), MDB-9, OSE-7.
Fixtures. operators/057-062, dialect-parity/026.