From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: So what's an "empty" array anyway? |
Date: | 2008-11-12 15:58:48 |
Message-ID: | 491AFD38.2030106@gmx.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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 ...
From | Date | Subject | |
---|---|---|---|
Next Message | Alex Hunsaker | 2008-11-12 16:05:26 | Re: SSL cleanups/hostname verification |
Previous Message | Peter Eisentraut | 2008-11-12 15:56:57 | Re: array_length() |