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

From: Markus Bertheau <twanger(at)bluetwanger(dot)de>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [SQL] ARRAY() returning NULL instead of ARRAY[] resp. {}
Date: 2005-05-24 06:08:23
Message-ID: 1116914903.7306.3.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches pgsql-sql

Dnia 24-05-2005, wto o godzinie 00:06 -0400, Tom Lane napisał(a):
> Joe Conway <mail(at)joeconway(dot)com> writes:
> > 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?
>
> I think he's got a good point, actually. We document the ARRAY-with-
> parens-around-a-SELECT syntax as
>
> The resulting one-dimensional array will have an element for
> each row in the subquery result, with an element type matching
> that of the subquery's output column.
>
> To me, that implies that a subquery result of no rows generates a
> one-dimensional array of no elements, not a null array.
>
> The point Markus is complaining about seems like it should
> be easily fixable.

Great. Does this belong on the TODO?

--
Markus Bertheau <twanger(at)bluetwanger(dot)de>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Achilleus Mantzios 2005-05-24 06:21:18 Re: ARRAY() returning NULL instead of ARRAY[] resp. {}
Previous Message Markus Bertheau 2005-05-24 06:02:25 Re: ARRAY() returning NULL instead of ARRAY[] resp. {}

Browse pgsql-patches by date

  From Date Subject
Next Message Achilleus Mantzios 2005-05-24 06:21:18 Re: ARRAY() returning NULL instead of ARRAY[] resp. {}
Previous Message Markus Bertheau 2005-05-24 06:02:25 Re: ARRAY() returning NULL instead of ARRAY[] resp. {}

Browse pgsql-sql by date

  From Date Subject
Next Message Achilleus Mantzios 2005-05-24 06:21:18 Re: ARRAY() returning NULL instead of ARRAY[] resp. {}
Previous Message Markus Bertheau 2005-05-24 06:02:25 Re: ARRAY() returning NULL instead of ARRAY[] resp. {}