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

From Darren Duncan
Subject Re: [PATCH] Exorcise "zero-dimensional" arrays (Was: Re: Should array_length() Return NULL)
Date
Msg-id 51B929F9.9040909@darrenduncan.net
Whole thread Raw
In response to Re: [PATCH] Exorcise "zero-dimensional" arrays (Was: Re: Should array_length() Return NULL)  (Josh Berkus <josh@agliodbs.com>)
List 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




pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: Parallell Optimizer
Next
From: Tom Dunstan
Date:
Subject: Re: Patch to add support of "IF NOT EXISTS" to others "CREATE" statements