Re: [PATCH] Exorcise "zero-dimensional" arrays (Was: Re: Should array_length() Return NULL) - Mailing list pgsql-hackers

From Dean Rasheed
Subject Re: [PATCH] Exorcise "zero-dimensional" arrays (Was: Re: Should array_length() Return NULL)
Date
Msg-id CAEZATCVcW1ztFoSsa7ODFd+4GJvfmjUudvC_JO6D1Q-xa+kO5w@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] Exorcise "zero-dimensional" arrays (Was: Re: Should array_length() Return NULL)  (Brendan Jurd <direvus@gmail.com>)
Responses Re: [PATCH] Exorcise "zero-dimensional" arrays (Was: Re: Should array_length() Return NULL)  (Brendan Jurd <direvus@gmail.com>)
List pgsql-hackers
On 27 March 2013 17:14, Brendan Jurd <direvus@gmail.com> wrote:
> On 28 March 2013 00:21, Dean Rasheed <dean.a.rasheed@gmail.com> wrote:
>> The patch is also allowing '{{},{},{}}' which is described up-thread
>> as a 2-D empty array. That's pretty misleading, since it has length 3
>> (in the first dimension). '{{},{}}' and '{{}}' are both "more empty",
>> but neither is completely empty.
>
>> I'm not saying that the current situation is not broken. I'm just
>> questioning whether the fix is actually any less confusing than what
>> we have now.
>
> Well the fix is primarily about 1-D empty arrays, and in that respect
> it is much less confusing than what we have now.

Maybe. But even in 1-D, it's still jumping from having one empty array
to infinitely many starting at different indexes, e.g., '{}'::int[] !=
'[4:3]={}'::int[]. There may be a certain logic to that, but I'm not
convinced about its usefulness.

Also, it is incompatible with the choice made for empty ranges, which
are all normalised to a single unique empty range value --- the empty
set, with no start- or end-points. I find that quite logical, and so
to me, it makes most sense to also have a single unique empty array,
which is then necessarily dimensionless.

Regards,
Dean



pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: plpgsql_check_function - rebase for 9.3
Next
From: Tom Lane
Date:
Subject: Re: Catching resource leaks during WAL replay