Re: Do we want a hashset type?

From: "Joel Jacobson" <joel(at)compiler(dot)org>
To: "Tomas Vondra" <tomas(dot)vondra(at)enterprisedb(dot)com>, "jian he" <jian(dot)universality(at)gmail(dot)com>
Cc: "Tom Dunstan" <pgsql(at)tomd(dot)cc>, "Andrew Dunstan" <andrew(at)dunslane(dot)net>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Do we want a hashset type?
Date: 2023-06-25 20:35:47
Message-ID: 0f6d4856-95b8-415c-b820-b319da61ce1c@app.fastmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Jun 25, 2023, at 11:42, Joel Jacobson wrote:
> SELECT hashset_contains('{}'::int4hashset, NULL::int);
>
> would be False, according to the General Rules.
>
...
> Applying the same rules, we'd have to return Unknown (which we represent as
> null) for:
>
> SELECT hashset_contains('{null}'::int4hashset, NULL::int);
>

Aha! I just discovered to my surprise that the corresponding array
queries gives the same result:

SELECT NULL = ANY(ARRAY[]::int[]);
?column?
----------
f
(1 row)

SELECT NULL = ANY(ARRAY[NULL]::int[]);
?column?
----------

(1 row)

I have no more objections; let's stick to the same null semantics as arrays and multisets.

/Joel

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2023-06-25 20:49:04 Re: Speeding Up Bitmapset
Previous Message James Coleman 2023-06-25 19:21:24 Re: Stampede of the JIT compilers