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

From: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
To: Brendan Jurd <direvus(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Josh Berkus <josh(at)agliodbs(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH] Exorcise "zero-dimensional" arrays (Was: Re: Should array_length() Return NULL)
Date: 2013-03-27 22:39:52
Message-ID: CAEZATCVcW1ztFoSsa7ODFd+4GJvfmjUudvC_JO6D1Q-xa+kO5w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 27 March 2013 17:14, Brendan Jurd <direvus(at)gmail(dot)com> wrote:
> On 28 March 2013 00:21, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2013-03-27 23:01:25 Re: Catching resource leaks during WAL replay
Previous Message Pavel Stehule 2013-03-27 22:25:35 Re: plpgsql_check_function - rebase for 9.3