I want to pass an integer array from input parameters of my postgresql function into sql IN clause.
Into what and how I can convert such array?
I want to pass an integer array from input parameters of my postgresql function into sql IN clause.
Into what and how I can convert such array?
I had same problem lately.
Look here:
Hope it helps.
Here is a sample function:
CREATE OR REPLACE FUNCTION "GetSetOfObjects"(ids text)
RETURNS SETOF record AS
$BODY$select *
from objects
where id = any(string_to_array($1,',')::integer[]);$BODY$
LANGUAGE sql IMMUTABLE
Basically you can't. What you can do is pass in a comma-delimited list and split it apart in your function. Here are some examples using SQL Server, but I'm sure they can be translated.
Unless this (PostgreSQL) is what you're talking about.
i usually use implicit conversion
select '{1,2,3,4,5}' :: integer[]