SELECT 'CREATE OR REPLACE VIEW ' || schemaname || '.' || viewname || ' AS ' || definition FROM pg_views WHERE schemaname != 'pg_catalog' and schemaname != 'information_schema' -- Replace with your schema name ;