or just ommit the is_visible from the First query, but please keep clear of that : "AND c.relname !~ '^(pg_|sql_)' " which is useless and can just lead to errors. (damn! do you really suggest I can not have a table name "sql_zend" or "pg_rox" ?!)