postgresql: any on subquery returning array
any, arrays, postgresql, subquery
Solution
Try this instead:
select id, alias from users
where (select user_list from user_lists where id = 2 limit 1)
@> ARRAY[id];
Problem
I have a user_lists table that contains a user_list column of type integer[]. I'm trying to do this query, which seems basic enough: `select id, alias from users where id = ANY(select user_list from user_lists where id = 2 limit 1);` It gives this error: ERROR: operator does not exist: integer = integer[] HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. I'm using postgres 8.3.11. Upgrading is not an option. What am I missing?