Re: Overlap operators for ARRAY and NULLs

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Overlap operators for ARRAY and NULLs
Date: 2011-03-10 21:16:07
Message-ID: 201103102116.p2ALG7N10878@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


I have added a link to this from the exiting TODO item:

Improve handling of NULLs in arrays

* BUG #4509: array_cat's null behaviour is inconsistent
* http://archives.postgresql.org/pgsql-hackers/2010-11/msg01040.php

---------------------------------------------------------------------------

Itagaki Takahiro wrote:
> There might be inconsistency in overlap operators for array
> types ( <@, @>, and && ) when the argument arrays contain NULLs.
>
> - SELECT 2 = ANY (ARRAY[1, NULL]) => NULL
> - SELECT ARRAY[2] <@ ARRAY[1, NULL] => false
>
> NULL means "unknown" in definition, so should it return NULL
> rather than false?
>
> I found the issue when I read spec of MULTISET. In the SQL
> standard, the following expression returns NULL. I was thinking
> to make SUBMULTISET OF to be an alias of <@ operator, but
> they seems to be incompatible.
>
> - MULTISET[2] SUBMULTISET OF MULTISET[1, NULL] => NULL
>
> Will we change the operator's behavior? It would be more
> consistent, but incompatible with older server versions.
> If impossible, I'll add separated submultiset_of() function
> instead of <@ operator for MULTISET supports.
>
> --
> Itagaki Takahiro
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Martijn van Oosterhout 2011-03-10 21:18:35 Re: FuncExpr.collid/OpExpr.collid unworkably serving double duty
Previous Message Bruce Momjian 2011-03-10 20:59:22 Re: plpgsql execute vs. SELECT ... INTO