How come when I pass in a list in it doesn't use it as a list of integers? Do I need to somehow make $1 be interpreted as a list of ints? Rather than just passing a text value that contains the list?
CREATE TABLE my_tbl (u_id int);
INSERT INTO my_tbl (u_id) values (1);
INSERT INTO my_tbl (u_id) values (2);
INSERT INTO my_tbl (u_id) values (3);
CREATE OR REPLACE FUNCTION getlist(text) RETURNS SETOF my_tbl as $$
SELECT * FROM my_tbl
WHERE u_id IN (0, $1);
$$ LANGUAGE SQL;
SELECT * from getlist('1,2,3');
(0 rows)
I'm sure it's probably trival but I'm still learning how psql :) Thanks
Yahoo! Photos
Got holiday prints?
See all the ways to get quality prints in your hands ASAP.