Re: So what's an "empty" array anyway?
| От | Peter Eisentraut |
|---|---|
| Тема | Re: So what's an "empty" array anyway? |
| Дата | |
| Msg-id | 491AFD38.2030106@gmx.net обсуждение исходный текст |
| Ответ на | Re: So what's an "empty" array anyway? ("Robert Haas" <robertmhaas@gmail.com>) |
| Ответы |
Re: So what's an "empty" array anyway?
|
| Список | pgsql-hackers |
Robert Haas wrote:
>> 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.
That is your opinion, but not my argument above.
> 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.
Which doesn't necessarily make much sense ...
В списке pgsql-hackers по дате отправления: