BUG #13420: Array function contains with null

Started by Nonamealmost 11 years ago2 messagesbugs
Jump to latest
#1Noname
krzysztof.czajka@turcom.pl

The following bug has been logged on the website:

Bug reference: 13420
Logged by: Krzysztof Czajka
Email address: krzysztof.czajka@turcom.pl
PostgreSQL version: 9.3.8
Operating system: CentOS release 6.6 (Final)
Description:

Function contains on array with null element isn't work correctly.

SELECT ARRAY[1,4,3] @> ARRAY[3,1]
true

SELECT ARRAY[ NULL ] @> ARRAY[ NULL ]
false

SELECT ARRAY[ NULL::varchar,'2' ] @> ARRAY[ NULL::varchar ]
false

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Noname (#1)
Re: BUG #13420: Array function contains with null

krzysztof.czajka@turcom.pl writes:

Function contains on array with null element isn't work correctly.

SELECT ARRAY[1,4,3] @> ARRAY[3,1]
true

SELECT ARRAY[ NULL ] @> ARRAY[ NULL ]
false

SELECT ARRAY[ NULL::varchar,'2' ] @> ARRAY[ NULL::varchar ]
false

That looks fine to me, because NULL isn't equal to NULL.

regards, tom lane

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs