Re: Do we want a hashset type? - Mailing list pgsql-hackers

From Joel Jacobson
Subject Re: Do we want a hashset type?
Date
Msg-id a5e83c63-c3ae-4422-9606-cb0f66eaa741@app.fastmail.com
Whole thread Raw
In response to Re: Do we want a hashset type?  (jian he <jian.universality@gmail.com>)
Responses Re: Do we want a hashset type?
List pgsql-hackers
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
Attachment

pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Synchronizing slots from primary to standby
Next
From: Jelte Fennema
Date:
Subject: Re: Deleting prepared statements from libpq.