Re: ARRAY() returning NULL instead of ARRAY[] resp. {}

Поиск
Список
Период
Сортировка
От Achilleus Mantzios
Тема Re: ARRAY() returning NULL instead of ARRAY[] resp. {}
Дата
Msg-id Pine.LNX.4.44.0505240911160.10967-100000@matrix.gatewaynet.com
обсуждение исходный текст
Ответ на Re: ARRAY() returning NULL instead of ARRAY[] resp. {}  (Joe Conway <mail@joeconway.com>)
Список pgsql-sql
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



В списке pgsql-sql по дате отправления:

Предыдущее
От: Markus Bertheau
Дата:
Сообщение: Re: ARRAY() returning NULL instead of ARRAY[] resp. {}
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: datatype conversion on postgresql 7.4.1