I would like to do something like this: create function x(varchar) returns setof int4 as 'select * from $1;' language 'sql'; Unfortunately, the parser drops me back: I cannot use any parameters after the keyword "from". How to solve this? A solution in PL/PgSQL would be also nice. Thanks in advance, Zoltan