Re: So what's an "empty" array anyway?

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: So what's an "empty" array anyway?
Дата
Msg-id 603c8f070811120646u466ed30q655843f857e35e8a@mail.gmail.com
обсуждение исходный текст
Ответ на Re: So what's an "empty" array anyway?  (Peter Eisentraut <peter_e@gmx.net>)
Ответы Re: So what's an "empty" array anyway?  (Sam Mason <sam@samason.me.uk>)
Re: So what's an "empty" array anyway?  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-hackers
> It was pointed out to me today that a zero-dimensional matrix is a scalar.
>  This makes a bit of sense, if you say that
>
> '{{56}}' is of type int[][], 2 dimensions
> '{56}' is of type int[], 1 dimension
> '56' is of type int, 0 dimensions
>
> Notice that the number of brace pairs in the literal matches the number of
> bracket pairs in the type declaration.
>
> By that logic, '{}' has one dimension.  I think this also works best in
> practice, for example with array concatenation.

I think it's actually more correct to say that {} has an undefined
number of dimensions.  The || operator is valid only if the dimensions
of the two arrays are equal (in which case it appends them) or if the
dimension of one of the arrays is one less than the other (in which
case, if legal, it treats the array of lesser dimension as a new
element to be added to the other array).

But {}, and ONLY {}, can be concatenated with an array of any number
of dimensions.

...Robert


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

Предыдущее
От: Andrew Chernow
Дата:
Сообщение: libpq-events windows gotcha
Следующее
От: Sam Mason
Дата:
Сообщение: Re: So what's an "empty" array anyway?