On Mon, Jun 19, 2023, at 02:00, jian he wrote:
> select hashset_contains('{1,2}'::int4hashset,NULL::int);
> should return null?
I agree, it should.
I've now changed all functions except int4hashset() (the init function)
and the aggregate functions to be STRICT.
I think this patch is OK to send as an incremental one, since it's an isolated change:
Apply STRICT to hashset functions; clean up null handling in hashset-api.c
Set hashset functions to be STRICT, thereby letting the system reject null
inputs automatically. This change reflects the nature of hashset as an
implementation of a set-theoretic system, where null values are conceptually
unusual.
Alongside, the hashset-api.c code has been refactored for clarity, consolidating
null checks and assignments into single lines.
A 'strict' test case has been added to account for these changes.
/Joel