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

Поиск
Список
Период
Сортировка
От Brendan Jurd
Тема Re: [PATCH] Exorcise "zero-dimensional" arrays (Was: Re: Should array_length() Return NULL)
Дата
Msg-id CADxJZo2oaZcp-FLcSq3m=DOf47pBc7r9SbsPERqUo+m+sow=Cg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [PATCH] Exorcise "zero-dimensional" arrays (Was: Re: Should array_length() Return NULL)  (Kevin Grittner <kgrittn@ymail.com>)
Ответы Re: [PATCH] Exorcise "zero-dimensional" arrays (Was: Re: Should array_length() Return NULL)  (Kevin Grittner <kgrittn@ymail.com>)
Список pgsql-hackers
On 6 April 2013 01:59, Kevin Grittner <kgrittn@ymail.com> wrote:
> Brendan Jurd <direvus@gmail.com> wrote:
>
>> The language specifically allows for zero elements, and does not
>> contemplate multiple dimensions.
>
> I don't remember anything in the spec which would prohibit the data
> type of an array element from itself being an array, however.

Indeed it does not prohibit nesting arrays inside other arrays, but
the multidim arrays that Postgres allows you to create are not the
same thing as nested arrays.

I believe that a purely to-spec implementation would allow you to make
an array-of-int-arrays, but since each element is its own separate
collection there would be no requirement that they have the same
cardinality as each other.

For example, ARRAY[[1], [2,3], [4,5,6]] is a valid collection per the
spec, but Postgres won't let you create this, because Postgres is
trying to create a 2-D matrix of integers, rather than a collection of
collections of integers.

The inability to extend multidim arrays in Postgres is another
manifestation of this matrix-oriented design.  Extending nested
collections is a no-brainer.  Extending matrices while ensuring they
remain perfectly regular ... not so much.

Cheers,
BJ



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Heikki Linnakangas
Дата:
Сообщение: Re: Enabling Checksums
Следующее
От: Matthias Nagel
Дата:
Сообщение: Fwd: Range types (DATERANGE, TSTZRANGE) in a foreign key with "inclusion" logic