I need to get table names from a schema, except for some tables
CREATE OR REPLACE FUNCTION func(unnecessary_tables TEXT)
returns void
as $$
begin
EXECUTE 'SELECT table_name FROM information_schema.tables
WHERE
table_schema=''public''
AND
table_name NOT IN( $1 )
' USING unnecessary_tables
end;
$$language plpgsql
Then the function is called
select func('table1'',''table2');
This does not work and returns the result table1and table2.
Question: how to pass a text parameter to a stored function for an operator IN?
source
share