Re: ScalarArrayOpExpr and multi-dimensional arrays

Поиск
Список
Период
Сортировка
Искать
От
Amit Langote
Тема
Re: ScalarArrayOpExpr and multi-dimensional arrays
Дата
Msg-id
0fd1b9d4-057c-a806-861d-62c7b83a94d3@lab.ntt.co.jp
Ответ на
Список
Дерево обсуждения
ScalarArrayOpExpr and multi-dimensional arrays Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Re: ScalarArrayOpExpr and multi-dimensional arrays Tom Lane <tgl@sss.pgh.pa.us>
Re: ScalarArrayOpExpr and multi-dimensional arrays Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
On 2017/12/08 23:34, Tom Lane wrote:
> Amit Langote  writes:
>> I wonder if ScalarArrayOpExpr is not really meant for multi-dimensional
>> arrays appearing on the right hand side?  Because:
>> # select array[1] = any (array[array[1], array[2]]);
> 
>> ERROR:  operator does not exist: integer[] = integer
> 
> You are falling into the misimpression that a 2-D array is an array of
> 1-D arrays.  It is not, even if the syntax makes it look like that.
> 
> ScalarArrayOpExpr just iterates over the array elements without regard
> to dimensionality; so the LHS must be of the element type.

Yeah, I can now see that.

Although, I wonder if there is any room for improvement here.  Instead of
waiting for make_scalar_array_op() to emit the error as it does today,
would it be better if we error'd out earlier saying "ERROR: ANY/ALL
leftarg must be scalar, not array"?  Attached a patch for that, if it's
worth going for at all.

Thanks,
Amit
В списке pgsql-hackers по дате отправления
От: David Rowley
Дата:
От: Thomas Munro
Дата:
FAQ