Skip to content

sys.schema

A system view that returns information about the schemas in the database.

Column NameData TypeDescription
schema_idbigintUnique ID of the schema. User-defined schemas have IDs greater than 16000.
database_idbigintUnique ID of the database where the schema belongs.
namevarchar(256)Name of the schema.
owner_idbigintUnique ID of the user who owns the schema. Join to sys.user to get the name of the user.
creation_timetimestamptzWhen the schema was created.

For example:

premdb=# select * from sys.schema where schema_id >16000;
 schema_id | database_id | owner_id |  name  |         creation_time         
-----------+-------------+----------+--------+-------------------------------
    25031 |       16397 |       10 | newone | 2019-12-11 17:15:53.39047-08
    25032 |       16397 |       10 | dev    | 2019-12-11 17:17:05.62417-08
    25033 |       16397 |       10 | prod   | 2019-12-11 17:17:13.260892-08
(3 rows)

Parent topic:System Views