Skip to content

sys.view

A system view that returns information about the user-defined views in the database.

Column NameData TypeDescription
view_idbigintUnique ID of the view.
database_idbigintUnique ID of the database where the view was created.
schema_idbigintUnique ID of the schema where the view was created. Join to sys.schema to get the schema name.
nametextName of the view.
owner_idbigintUnique ID of the user who owns the view. Join to sys.user to get the name of the user.
definitiontextSQL text of the view.
is_tempbooleanWhether the view was created as a temporary view (f=persistent; t=temporary).
creation_timetimestamptzWhen the view was created.
database_nametextName of the database where the procedure was created.

For example:

premdb=# select * from sys.view;
 view_id | database_id | schema_id |   name    | owner_id |                 definition                 | is_temp |         creation_time         | database_name 
---------+-------------+-----------+-----------+----------+--------------------------------------------+---------+-------------------------------+---------------
   19125 |       16395 |     19124 | matchview |       10 |  SELECT match.seasonid,                   +| f       | 2020-02-17 20:48:13.813629-08 | premdb
        |             |           |           |          |     match.matchday,                       +|         |                               | 
        |             |           |           |          |     match.htid,                           +|         |                               | 
        |             |           |           |          |     match.atid,                           +|         |                               | 
        |             |           |           |          |     match.ftscore,                        +|         |                               | 
        |             |           |           |          |     match.htscore                         +|         |                               | 
        |             |           |           |          |    FROM match                             +|         |                               | 
        |             |           |           |          |   WHERE (match.seasonid BETWEEN 5 AND 15); |         |                               | 
(1 row)

Parent topic:System Views