From: | Achilleus Mantzios <achill(at)matrix(dot)gatewaynet(dot)com> |
---|---|
To: | Joe Conway <mail(at)joeconway(dot)com> |
Cc: | Markus Bertheau <twanger(at)bluetwanger(dot)de>, <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: ARRAY() returning NULL instead of ARRAY[] resp. {} |
Date: | 2005-05-24 06:21:18 |
Message-ID: | Pine.LNX.4.44.0505240911160.10967-100000@matrix.gatewaynet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches 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
From | Date | Subject | |
---|---|---|---|
Next Message | Simon Riggs | 2005-05-24 06:40:43 | Re: Speeding up the Postgres lexer |
Previous Message | Markus Bertheau | 2005-05-24 06:08:23 | Re: [SQL] ARRAY() returning NULL instead of ARRAY[] resp. {} |
From | Date | Subject | |
---|---|---|---|
Next Message | Ian FREISLICH | 2005-05-24 07:02:58 | [PATCH] pg_autovacuum commandline password hiding. |
Previous Message | Markus Bertheau | 2005-05-24 06:08:23 | Re: [SQL] ARRAY() returning NULL instead of ARRAY[] resp. {} |
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Huxton | 2005-05-24 07:45:46 | Re: datatype conversion on postgresql 7.4.1 |
Previous Message | Markus Bertheau | 2005-05-24 06:08:23 | Re: [SQL] ARRAY() returning NULL instead of ARRAY[] resp. {} |