Re: ScalarArrayOpExpr and multi-dimensional arrays

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ScalarArrayOpExpr and multi-dimensional arrays
Date: 2017-12-08 14:34:02
Message-ID: 7677.1512743642@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)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.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2017-12-08 14:51:19 Re: How to use set/reset role in contrib_regression test?
Previous Message Oliver Ford 2017-12-08 14:34:01 Re: proposal: alternative psql commands quit and exit