The system catalog
PostgreSQL describes all database objects using the meta information stored in database relations. These relations hold information about tables, views, functions, indexes, foreign data wrappers (FDWs), triggers, constraints, rules, users, groups, and so on. This information is stored in the pg_catalog
schema, and to make it more human readable, PostgreSQL also provides the information_schema
schema, where the meta information is wrapped and organized in views.
In the psql client, one can see exactly what is happening behind the scene when a certain meta command is executed, such as \z
, by enabling ECHO_HIDDEN
. The ECHO_HIDDEN
or -E
switch allow users to study the internals of PostgreSQL. You need to run the following command:
car_portal=# \set ECHO_HIDDEN car_portal=# \z car_portal_app.car ********* QUERY ********** SELECT n.nspname as "Schema", c.relname as "Name", CASE c.relkind WHEN 'r' THEN 'table' WHEN 'v' THEN 'view' WHEN 'm' THEN 'materialized view' WHEN 'S...