Re: [SQL] ARRAY() returning NULL instead of ARRAY[] resp. {} - Mailing list pgsql-hackers

From Joe Conway
Subject Re: [SQL] ARRAY() returning NULL instead of ARRAY[] resp. {}
Date
Msg-id 42A470B5.8060007@joeconway.com
Whole thread Raw
In response to Re: [SQL] ARRAY() returning NULL instead of ARRAY[] resp. {}  (Markus Bertheau ☭ <twanger@bluetwanger.de>)
Responses Re: [SQL] ARRAY() returning NULL instead of ARRAY[] resp.
List pgsql-hackers
Markus Bertheau ☭ wrote:
> В Пнд, 06/06/2005 в 10:44 -0400, Tom Lane пишет:
>>Markus Bertheau ☭ <twanger@bluetwanger.de> writes:
>>
>>>By analogy, array_upper('{}'::TEXT[], 1) should return 0 instead of
>>>NULL.
>>
>>No, that doesn't follow ... we've traditionally considered '{}' to
>>denote a zero-dimensional array.
> 
> But array_upper(ARRAY(SELECT 1 WHERE FALSE), 1) should return 0,
> and array_upper(ARRAY[], 1), when the ARRAY[] syntax is supported,
> should return 0.
> 

Actually, consistent with my last post, I think array_upper() on a 
zero-element array should return NULL. A zero-element array has a 
defined lower bound, but its upper bound is not zero -- it is really 
undefined.

Joe


pgsql-hackers by date:

Previous
From: Joe Conway
Date:
Subject: Re: [SQL] ARRAY() returning NULL instead of ARRAY[] resp. {}
Next
From: Joe Conway
Date:
Subject: Re: [SQL] ARRAY() returning NULL instead of ARRAY[] resp.