BUG #15298: Array-array comparisons when arrays contain NULLs

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: knz(at)thaumogen(dot)net
Subject: BUG #15298: Array-array comparisons when arrays contain NULLs
Date: 2018-07-26 13:43:06
Message-ID: 153261258644.1404.3005762345361971551@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 15298
Logged by: kena
Email address: knz(at)thaumogen(dot)net
PostgreSQL version: 10.4
Operating system: FreeBSD + Linux
Description:

The SQL standard mandates ternary logic for values that involve NULL, where
NULL means "unknown".

This seems to be implemented only partially in pg:

"select 3 = any (array[1, null])" -> returns NULL, correct
"select null = any (array[1, null])" -> returns NULL, correct
"select 3 in (select unnest(array[1,null]))" -> returns NULL, correct
"select null in (select unnest(array[1,null]))" -> returns NULL, correct

However:

"select array[1,2] = array[1,null]" -> returns false !?
"select array[1,null] = array[1,null]" -> returns true !?

Is this intended behavior? If so, where is it documented?

If not intended, any suggestion as to how to work around it?

Thanks in advance,

--
Raphael 'kena' Poss

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2018-07-26 14:03:56 Re: BUG #15297: Irregular comparison rules for NULLs in tuples
Previous Message PG Bug reporting form 2018-07-26 13:35:27 BUG #15297: Irregular comparison rules for NULLs in tuples