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

From: Joe Conway <mail(at)joeconway(dot)com>
To: Markus Bertheau ☭ <twanger(at)bluetwanger(dot)de>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [SQL] ARRAY() returning NULL instead of ARRAY[] resp. {}
Date: 2005-06-06 15:50:13
Message-ID: 42A470B5.8060007@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches pgsql-sql

Markus Bertheau ☭ wrote:
> В Пнд, 06/06/2005 в 10:44 -0400, Tom Lane пишет:
>>Markus Bertheau =?UTF-8?Q?=E2=98=AD?= <twanger(at)bluetwanger(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joe Conway 2005-06-06 15:58:28 Re: [SQL] ARRAY() returning NULL instead of ARRAY[] resp.
Previous Message Joe Conway 2005-06-06 15:39:48 Re: ARRAY() returning NULL instead of ARRAY[] resp. {}

Browse pgsql-patches by date

  From Date Subject
Next Message Joe Conway 2005-06-06 15:58:28 Re: [SQL] ARRAY() returning NULL instead of ARRAY[] resp.
Previous Message Joe Conway 2005-06-06 15:39:48 Re: ARRAY() returning NULL instead of ARRAY[] resp. {}

Browse pgsql-sql by date

  From Date Subject
Next Message Joe Conway 2005-06-06 15:58:28 Re: [SQL] ARRAY() returning NULL instead of ARRAY[] resp.
Previous Message Joe Conway 2005-06-06 15:39:48 Re: ARRAY() returning NULL instead of ARRAY[] resp. {}