<!-- doc/src/sgml/catalogs.sgml -->
<!--
Documentation of the system catalogs, directed toward PostgreSQL developers
-->
<chapter id="catalogs">
<title>System Catalogs</title>
<para>
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.
<productname>PostgreSQL</productname>'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 normally SQL commands to do that. (For example, <command>CREATE
DATABASE</command> inserts a row into the
<structname>pg_database</structname> catalog — and actually
creates the database on disk.) There are some exceptions for
particularly esoteric operations, but many of those have been made
available as SQL commands over time, and so the need for direct manipulation
of the system catalogs is ever decreasing.
</para>
<sect1 id="catalogs-overview">
<title>Overview</title>
<para>
<xref linkend="catalog-table"/> lists the system catalogs.
More detailed documentation of each catalog follows below.
</para>
<para>
Most system catalogs are copied from the template database during
database creation and are thereafter database-specific. A few
catalogs are physically shared across all databases in a cluster;
these are noted in the descriptions of the individual catalogs.
</para>
<table id="catalog-table">
<title>System Catalogs</title>
<tgroup cols="2">
<thead>
<row>
<entry>Catalog Name</entry>
<entry>Purpose</entry>
</row>
</thead>
<tbody>
<row>
<entry><link linkend="catalog-pg-aggregate"><structname>pg_aggregate</structname></link></entry>
<entry>aggregate functions</entry>
</row>
<row>
<entry><link linkend="catalog-pg-am"><structname>pg_am</structname></link></entry>
<entry>relation access methods</entry>
</row>
<row>
<entry><link linkend="catalog-pg-amop"><structname>pg_amop</structname></link></entry>
<entry>access method operators</entry>
</row>
<row>
<entry><link linkend="catalog-pg-amproc"><structname>pg_amproc</structname></link></entry>
<entry>access method support functions</entry>
</row>
<row>
<entry><link linkend="catalog-pg-attrdef"><structname>pg_attrdef</structname></link></entry>
<entry>column default values</entry>
</row>
<row>
<entry><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link></entry>
<entry>table columns (<quote>attributes</quote>)</entry>
</row>
<row>
<entry><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link></entry>
<entry>authorization identifiers (roles)</entry>
</row>
<row>
<entry><link linkend="catalog-pg-auth-members"><structname>pg_auth_members</structname></link></entry>
<entry>authorization identifier membership relationships</entry>
</row>
<row>
<entry><link linkend="catalog-pg-cast"><structname>pg_cast</structname></link></entry>
<entry>casts (data type conversions)</entry>
</row>
<row>
<entry><link linkend="catalog-pg-class"><structname>pg_class</structname></link></entry>
<entry>tables, indexes, sequences, views (<quote>relations</quote>)</entry>
</row>
<row>
<entry><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link></entry>
<entry>collations (locale information)</entry>
</row>
<row>
<entry><link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link></entry>
<entry>check constraints, unique constraints, primary key constraints, foreign key constraints</entry>
</row>