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

From: Brendan Jurd <direvus(at)gmail(dot)com>
To: Dean Rasheed <dean(dot)a(dot)rasheed(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-29 00:12:59
Message-ID: CADxJZo3fXdFCNS_sMyAiBgPCzbGLnYwCdnQaXLqARPntD5MFJQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 28 March 2013 20:34, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> wrote:
> Is the patch also going to allow empty arrays in higher dimensions
> where not just the last dimension is empty?

It doesn't allow that at present.

> It seems as though, if
> it's allowing 1-by-0 arrays like '{{}}' and '[4:4][8:7]={{}}', it
> should also allow 0-by-0 arrays like '[4:3][8:7]={}', and 0-by-3
> arrays like '[4:3][11:13]={}'.

I think the array literal parser would reject this on the grounds that
the brace structure doesn't match the dimension specifiers. You could
modify that check to respect zero length in dimensions other than the
innermost one, but it's hard to say whether it would be worth the
effort.

It might be instructive to hear from somebody who does (or intends to)
use multidim arrays for some practical purpose, but I don't even know
whether such a person exists within earshot of this list.

Cheers,
BJ

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2013-03-29 01:02:06 Re: Enabling Checksums
Previous Message Stephen Frost 2013-03-28 23:56:27 Hash Join cost estimates