Cloud

pg_views

The pg_views catalog contains information about the views in the database and the query that defines each view. It mimics the pg_views PostgreSQL system catalog.

The catalog lists only the views that you have a privilege on, in schemas that you have a privilege on.

Columns

Column Type Description

schemaname

text

Name of the schema that contains the view

viewname

text

Name of the view

viewowner

text

Unused. This column is always empty.

definition

text

The SELECT query that defines the view, exactly as written in the CREATE VIEW statement, including line breaks

Examples

Create a view:

CREATE VIEW large_orders AS SELECT order_id, customer, amount FROM default_redpanda_catalog=>orders WHERE amount > 100;

List the views in the public schema and their definitions:

SELECT viewname, definition
FROM pg_views
WHERE schemaname = 'public';

The query returns:

   viewname   |                                         definition
--------------+---------------------------------------------------------------------------------------------
 large_orders | SELECT order_id, customer, amount FROM default_redpanda_catalog=>orders WHERE amount > 100
(1 row)

Suggested reading