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

From: Darren Duncan <darren(at)darrenduncan(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH] Exorcise "zero-dimensional" arrays (Was: Re: Should array_length() Return NULL)
Date: 2013-06-13 02:10:01
Message-ID: 51B929F9.9040909@darrenduncan.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2013.06.12 10:11 AM, Josh Berkus wrote:
>>> Multidim arrays are why we can't have nice things.
>>
>> Yeah, I think that was not our best moment. :-(
>
> Actually, if you think about it, we've never had "arrays" in PostgreSQL
> ... we have always had matrixes. If you think about things that way,
> most of the current functionality makes sense.

If the type system were changed so that arrays were were always just
one-dimensional, you can define your matrix simply as a binary relation type
whose primary key attribute has the type of a fixed-length array of integers,
where the number of elements in the array is the number of dimensions in the
matrix, and the array elements themselves defined the coordinates in the matrix.
This design confers a number of benefits. Also, the case of the
zero-dimension matrix needs no special treatment; the key array has zero
elements. Would that not work? -- Darren Duncan

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Dunstan 2013-06-13 02:35:52 Re: Patch to add support of "IF NOT EXISTS" to others "CREATE" statements
Previous Message Stephen Frost 2013-06-13 01:53:07 Re: Parallell Optimizer