I am making function and one of my feature is make use of SQL IN operator. Basically I would like query like this
select name
from atlas_ins_th_travel_place pp
where pp.name IN ('Guyana', 'Mexico');
Then I make function and accept varchar[] as an input like this
CREATE OR REPLACE FUNCTION test_place(
places VARCHAR[]
) RETURNS SETOF test_place_view AS
$$
DECLARE
dummy ALIAS FOR $1;
BEGIN
-- FOR i IN 1 .. array_upper(places, 1)
-- LOOP
-- RAISE NOTICE '%', places[i]; -- single quotes!
-- array_append(dummy, places[i])
-- END LOOP;
RETURN QUERY
select name
from atlas_ins_th_travel_place
where name in places;
END;
$$ LANGUAGE plpgsql STABLE;
Unfortunately it raises the error regarding operator. I have tried making new array and use with it. But it does not help
Question:
How to use IN operator with array?