O Joe Conway έγραψε στις May 23, 2005 :
> Markus Bertheau wrote:
> > why does SELECT ARRAY(SELECT 1 WHERE FALSE) return NULL instead of
> > ARRAY[] resp. '{}'?
> >
>
> Why would you expect an empty array instead of a NULL? NULL is what
> you'd get for other data types -- for example:
One could ask in the same fashion why someone would want a table
if this table contains no rows.
A null value may mean "dont know",
wheras a '{}' (empty) value may mean "empty set".
For instance lets consider the case where an array holds
the factors of a polynomial formula.
An null value might mean that the person defining
the formulas haven't been bothered with this one yet.
An empty value might mean that the person indicates
that has worked on this particular one, but he/she has no data yet.
Ok extreme cases, but to me there is a clean distinction
between a null array and an empty array.
Also what is definately needed is arrays that may contain
null values.
>
> regression=# SELECT (SELECT 1 WHERE FALSE) IS NULL;
> ?column?
> ----------
> t
> (1 row)
>
> Joe
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq
>
--
-Achilleus