Re: [SQL] PL/pgsql: function passing argument to IN operator

2007-12-28 Thread Pavel Stehule
Hello it has sense only for array type so you can try: create replace function foo(anyarray) returns bool as $$ begin return (select 1 = any($1)); end ; $$ language plpgsql; postgres=# select foo(array[1,2,3]); foo - t (1 row) postgres=# select foo(array[2,3]); foo - f (1 row) R

[SQL] PL/pgsql: function passing argument to IN operator

2007-12-28 Thread Daniel Myers
Hello list, I'm trying to write a function that uses one of its arguments as an input to an IN operator in a WHERE clause. I.e., something like: -- ids are actually integers CREATE FUNCTION foo(ids SOMETYPE) RETURNS [whatever] AS $$ BEGIN SELECT id, [other stuff] FROM table WHERE [other cond