3
System catalog
A set of tables and views describing all objects
in a database cluster
Schemas
primary schema: pg_catalog
alternative view: information_schema (the SQL standard)
SQL access
view: SELECT
update: CREATE, ALTER, DROP
psql access
quality-of-life commands
The system catalog is a collection of tables and views that describe all
database objects. It is metadata for the contents of the cluster.
You can access this metadata using regular SQL queries. SELECT
commands can give a description of an object, and DDL (Data Definition
Language) commands let you add and modify objects.
All system catalog tables and views are located in the pg_catalog schema.
There is another schema, as defined by the SQL standard:
information_schema. It is more stable and portable than pg_catalog, but
does not reflect a number of specific features of PostgreSQL.
Client programs can read the contents of the system catalog and display it
to the user in a convenient way. For example, GUI-based development and
management environments usually come with a hierarchical object
navigation tool.
The psql client also offers a number of convenient built-in commands
specifically designed for working with the system catalog. Most of these
commands start with \d (as in “describe”). For the full list of commands and
their descriptions, see:
We will look at the most commonly used ones in the demo. The course
materials also include the catalogs.pdf file that features a diagram of the
main system catalog tables and related psql commands.