This query returns list of non-system views in a database with their definition.
select table_schema as schema_name, table_name as view_name, view_definition from information_schema.views where table_schema not in ('information_schema', 'pg_catalog') order by schema_name, view_name;
- schema_name - view's schema name
- view_name - view name
- view_definition - view's definition
- One row represents one view
- Scope of rows: non-system views in a database
- Ordered by schema and view name