two tables:
t1: id, x1 (integer)
t2: id, a2 (integer[])
The command:
SELECT id FROM t1s WHERE x1 IN (SELECT a2 FROM t2s WHERE id = #{id});
causes the ERROR:
operator does not exist: bigint = integer[]
The problem is caused by "SELECT a2 FROM t2s WHERE id = #{id}" returning an array of arrays (or maybe a list of arrays), but the "IN" command in the outer command is looking for an array of integers.
[a2] = SELECT a2 FROM t2s WHERE id = #{id}
would work if it's:
a2 = SELECT a2 FROM t2s WHERE id = #{id}
The problem remains the same if I tell psql that "(SELECT a2 FROM t2s WHERE id = #{id})" is only one row by "(SELECT a2 FROM t2s WHERE id = #{id} FETCH FIRST 1 ROW ONLY)"
So how to convert the list of arrays with one element "[a2]" to its single array element "a2"?