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
обсуждение исходный текст
Ответ на Re: ScalarArrayOpExpr and multi-dimensional arrays  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 2017/12/08 23:34, Tom Lane wrote:
> Amit Langote <Langote_Amit_f8@lab.ntt.co.jp> 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
Дата:
Сообщение: Re: Out of date comment in cached_plan_cost
Следующее
От: Thomas Munro
Дата:
Сообщение: Parallel Index Scan vs BTP_DELETED and BTP_HALF_DEAD