Chapter 3. System Catalogs

Table of Contents
3.1. Overview
3.2. pg_aggregate
3.3. pg_attrdef
3.4. pg_attribute
3.5. pg_class
3.6. pg_database
3.7. pg_description
3.8. pg_group
3.9. pg_index
3.10. pg_inherits
3.11. pg_language
3.12. pg_operator
3.13. pg_proc
3.14. pg_relcheck
3.15. pg_shadow
3.16. pg_statistic
3.17. pg_type

3.1. Overview

The system catalogs are the place where a relational database management system stores schema metadata, such as information about tables and columns, and internal bookkeeping information. PostgreSQL's system catalogs are regular tables. You can drop and recreate the tables, add columns, insert and update values, and severely mess up your system that way. Normally one should not change the system catalogs by hand, there are always SQL commands to do that. (For example, CREATE DATABASE inserts a row into the pg_database catalog -- and actually creates the database on disk.) There are some exceptions for esoteric operations, such as adding index access methods.

Table 3-1. System Catalogs

Catalog NamePurpose
pg_aggregateaggregate functions
pg_amindex access methods
pg_amopaccess method operators
pg_amprocaccess method support procedures
pg_attrdefcolumn default values
pg_attributetable columns (attributes, fields)
pg_classtables, indexes, sequences ("relations")
pg_databasedatabases
pg_descriptiondescriptions or comments on database objects
pg_groupuser groups
pg_indexadditional index information
pg_inheritstable inheritance hierarchy
pg_languagelanguages for writing functions
pg_largeobjectlarge objects
pg_listenerasynchronous notification
pg_opclassindex access method operator classes
pg_operatoroperators
pg_procfunctions and procedures
pg_relcheckcheck constraints
pg_rewritequery rewriter rules
pg_shadowdatabase users
pg_statisticoptimizer statistics
pg_triggertriggers
pg_typedata types

More detailed documentation of most catalogs follow below. The catalogs that relate to index access methods are explained in the Programmer's Guide. Some catalogs don't have any documentation, yet.