Reputation: 79
In PostgreSQL I am trying to convert an array to a list say I have an array: v_arr
I want to use this array in the below query in Postgres:
Select *
from table_name
where column_name in (v_arr)
Upvotes: 5
Views: 12194
Reputation: 59
You could use unnest
SELECT *
FROM table_name
WHERE column_name IN (SELECT unnest(v_arr));
https://www.postgresql.org/docs/current/static/functions-array.html
Upvotes: 5
Reputation: 176124
You could use = ANY
:
Select * from table_name where column_name = any (v_arr);
Upvotes: 3