# Databases : PostgreSQL : Introspection : pg_catalog
\[ [System Catalogs](https://www.postgresql.org/docs/current/catalogs.html) | [System Views](https://www.postgresql.org/docs/current/views.html) | [Statistics Views](https://www.postgresql.org/docs/current/monitoring-stats.html) ]
## Relations — Details
#### pg_attrdef
```
oid : oid UNKNOWN
adrelid : oid (-> pg_class.oid) column table ID
adnum : int2 (-> pg_attribute.attnum) column number
adbin : pg_node_tree column default value (in nodeToString() representation)
use pg_get_expr( adbin, adrelid ) to convert to an expression
pg_get_expr( adbin, adrelid ) -> default value ex: 42, now()
```
#### pg_attribute
"attribute" is a synonym for column — although it also stores rows for the columns of any object in `pg_class`.
```
attrelid : oid (-> pg_class.oid) column table ID
attname : name column name
atttypid : oid (-> pg_type.oid) column type ID
attlen : int2 A copy of pg_type.typlen of this column's type.
attnum : int2 column number; ordinary columns are numbered from 1 up, system columns have negative numbers
atttypmod : int4 type-specific data (like varchar length) (-1 if not needed)
attnotnull : bool True -> not-null constraint
atthasdef : bool True -> default or generation expression (in pg_attrdef)
attgenerated : char "s" -> generated (stored) column, "" -> not
attisdropped : bool
...
format_type( atttypid, atttypmod ) -> full type name ex: "geometry(Point,4326)"
```
#### pg_class
Describes tables and other objects that have columns or are otherwise similar to a table — aka, "relations".
This includes indexes, sequences, views, materialized views, composite types, and TOAST tables.
```
oid : oid table/view/index ID
relname : name
relnamespace : oid (-> pg_namespace.oid) schema ID
relhasindex : bool True if this is a table and it has (or recently had) any indexes
relpersistence : char p = permanent table/sequence, u = unlogged table/sequence, t = temporary table/sequence
relkind : char r = ordinary table, i = index, S = sequence, t = TOAST table, v = view, m = materialized view,
c = composite type, f = foreign table, p = partitioned table, I = partitioned index
relnatts : int2 number of user columns
relchecks : int2 number of CHECK constraints
```
#### pg_constraint
```
oid : oid constraint ID
conname : name constraint name
connamespace : oid (-> pg_namespace.oid) schema ID
contype : char c = check constraint, f = foreign key constraint, n = not-null constraint (domains only),
p = primary key constraint, u = unique constraint, t = constraint trigger, x = exclusion constraint
condeferrable : bool
condeferred : bool deferred by default?
conrelid : oid (-> pg_class.oid) table ID if table constraint, else 0
conindid : oid (-> pg_class.oid) index ID supporting this constraint if a unique/PK/FK/exclusion, else 0
confrelid : oid (-> pg_class.oid) target table ID if FK, else 0
confupdtype : char FK update action: a = no action, r = restrict, c = cascade, n = set null, d = set default
confdeltype : char FK deletion action: a = no action, r = restrict, c = cascade, n = set null, d = set default
conkey : int2[] (-> pg_attribute.attnum) constrained columns if table constraint (including FK)
confkey : int2[] (-> pg_attribute.attnum) referenced columns if FK
confdelsetcols : int2[] (-> pg_attribute.attnum) columns to update if FK with SET NULL or SET DEFAULT on delete; NULL -> all columns
conbin : pg_node_tree compiled expression if check constraint
pg_get_expr( conbin, conrelid ) -> constraint expression
```
#### pg_database
```
oid : oid database ID
datname : name database name
datconnlimit : int4 max concurrent connections
```
#### pg_depend
```
classid : oid (-> pg_class.oid) The OID of the system catalog the dependent object is in.
objid : oid (-> any OID column) The OID of the specific dependent object.
objsubid : int4 For a table column, this is the column number (the `objid` and `classid` refer to the table itself).
For all other object types, this column is zero.
refclassid : oid (-> pg_class.oid) The OID of the system catalog the referenced object is in.
refobjid : oid (-> any OID column) The OID of the specific referenced object.
refobjsubid : int4 For a table column, this is the column number (the `refobjid` and `refclassid` refer to the table itself).
For all other object types, this column is zero.
deptype : char Code defining semantics of relationship.
```
#### pg_enum
```
oid : oid
enumtypid : oid (-> pg_type.oid) enum type ID
enumsortorder : float4 sort position
enumlabel : name textual label
```
#### pg_extension
```
oid : oid Row identifier.
extname : name Name of the extension.
extowner : oid (-> pg_authid.oid) Owner of the extension.
extnamespace : oid (-> pg_namespace.oid) Schema containing the extension's exported objects.
extrelocatable : bool True if extension can be relocated to another schema.
extversion : text Version name for the extension.
extconfig : oid[] (-> pg_class.oid) Array of regclass OIDs for the extension's configuration table(s), or NULL if none.
extcondition : text[] Array of WHERE-clause filter conditions for the extension's configuration table(s), or NULL if none.
```
#### pg_index
```
indexrelid : oid (-> pg_class.oid) index ID
indrelid : oid (-> pg_class.oid) table ID
indnatts : int2 number of columns (same as pg_class.relnatts) (includes both key and included)
indnkeyatts : int2 number of key columns
indisunique : bool True -> unique index
indnullsnotdistinct : bool for unique indexes...
False -> consider null values distinct (index can contain multiple nulls) (default)
True -> consider null values to be equal (index can only contain one null)
indisprimary : bool True -> PK
indisexclusion : bool True -> supports an exclusion constraint
indkey : int2vector (-> pg_attribute.attnum) table columns in index
```
#### pg_namespace
```
oid : oid schema ID
nspname : name schema name
```
#### pg_sequence
```
seqrelid : oid (-> pg_class.oid) sequence ID
seqtypid : oid (-> pg_type.oid) type ID
seqstart : int8 start value
seqincrement : int8 increment value
seqmax : int8 maximum value
seqmin : int8 minimum value
seqcycle : bool whether it cycles
```
#### pg_stat_activity
```
datid : oid database ID
datname : name database name
pid : integer process ID
usesysid : oid user ID
usename : name user name
application_name : text client app name
client_addr : inet client IP
backend_start : timestamptz when process started / client connected
```
#### pg_tables
```
schemaname : name (-> pg_namespace.nspname) Name of schema containing table.
tablename : name (-> pg_class.relname) Name of table.
tableowner : name (-> pg_authid.rolname) Name of table's owner.
tablespace : name (-> pg_tablespace.spcname) Name of tablespace containing table (null if default for database).
hasindexes : bool (-> pg_class.relhasindex) True if table has (or recently had) any indexes.
hasrules : bool (-> pg_class.relhasrules) True if table has (or once had) rules.
hastriggers : bool (-> pg_class.relhastriggers) True if table has (or once had) triggers.
rowsecurity : bool (-> pg_class.relrowsecurity) True if row security is enabled on the table.
```
#### pg_type
```
oid : oid type ID
typname : name type name
typnamespace : oid (-> pg_namespace.oid) schema ID
typtype : char b = base type, c = composite type (e.g., a table's row type), d = domain,
e = enum type, p = pseudo-type, r = range type, or m = multirange type
```
## Relations — Descriptions
> [!NOTE] Legend
> - cs -> Collected Statistics Views
> - ds -> Dynamic Statistics Views
> - sc -> System Catalogs
> - sv -> System Views
- `sc: pg_aggregate` — ?
- `sc: pg_am` — ?
- `sc: pg_amop` — ?
- `sc: pg_amproc` — ?
- `sc: pg_attrdef` — column default values
- `sc: pg_attribute` — table columns (“attributes”)
- `sc: pg_authid` — ?
- `sc: pg_auth_members` — ?
- `sv: pg_available_extensions` — ?
- `sv: pg_available_extension_versions` — ?
- `sv: pg_backend_memory_contexts` — ?
- `sc: pg_cast` — ?
- `sc: pg_class` — tables, indexes, sequences, views (“relations”)
- `sc: pg_collation` — ?
- `sv: pg_config` — ?
- `sc: pg_constraint` — check constraints, unique constraints, primary key constraints, foreign key constraints
- `sc: pg_conversion` — ?
- `sv: pg_cursors` — ?
- `sc: pg_database` — ?
- `sc: pg_db_role_setting` — ?
- `sc: pg_default_acl` — ?
- `sc: pg_depend` — records dependencies between objects
- `sc: pg_description` — ?
- `sc: pg_enum` — enum label and value definitions
- `sc: pg_event_trigger` — ?
- `sc: pg_extension` — installed extensions
- `sv: pg_file_settings` — ?
- `sc: pg_foreign_data_wrapper` — ?
- `sc: pg_foreign_server` — ?
- `sc: pg_foreign_table` — ?
- `sv: pg_group` — ?
- `sv: pg_hba_file_rules` — ?
- `sv: pg_ident_file_mappings` — ?
- `sc: pg_index` — additional index information (the rest is mostly in `pg_class`)
- `sv: pg_indexes` — ?
- `sc: pg_inherits` — ?
- `sc: pg_init_privs` — ?
- `sc: pg_language` — ?
- `sc: pg_largeobject` — ?
- `sc: pg_largeobject_metadata` — ?
- `sv: pg_locks` — ?
- `sv: pg_matviews` — ?
- `sc: pg_namespace` — schemas
- `sc: pg_opclass` — ?
- `sc: pg_operator` — ?
- `sc: pg_opfamily` — ?
- `sc: pg_parameter_acl` — ?
- `sc: pg_partitioned_table` — ?
- `sv: pg_policies` — ?
- `sc: pg_policy` — ?
- `sv: pg_prepared_statements` — ?
- `sv: pg_prepared_xacts` — ?
- `sc: pg_proc` — ?
- `sc: pg_publication` — ?
- `sc: pg_publication_namespace` — ?
- `sc: pg_publication_rel` — ?
- `sv: pg_publication_tables` — ?
- `sc: pg_range` — ?
- `sc: pg_replication_origin` — ?
- `sv: pg_replication_origin_status` — ?
- `sv: pg_replication_slots` — ?
- `sc: pg_rewrite` — ?
- `sv: pg_roles` — ?
- `sv: pg_rules` — ?
- `sc: pg_seclabel` — ?
- `sv: pg_seclabels`
- `sc: pg_sequence` — sequences
- `sv: pg_sequences` — ?
- `sv: pg_settings` — ?
- `sv: pg_shadow` — ?
- `sc: pg_shdepend` — ?
- `sc: pg_shdescription` — ?
- `sv: pg_shmem_allocations` — ?
- `sc: pg_shseclabel` — ?
- `ds: pg_stat_activity` — one row per DB process
- `cs: pg_stat_all_indexes` — ?
- `cs: pg_stat_all_tables` — ?
- `cs: pg_stat_archiver` — ?
- `cs: pg_stat_bgwriter` — ?
- `cs: pg_stat_checkpointer` — ?
- `cs: pg_stat_database` — ?
- `cs: pg_stat_database_conflicts` — ?
- `ds: pg_stat_gssapi` — ?
- `cs: pg_stat_io` — ?
- `ds: pg_stat_progress_analyze` — ?
- `ds: pg_stat_progress_basebackup` — ?
- `ds: pg_stat_progress_cluster` — ?
- `ds: pg_stat_progress_copy` — ?
- `ds: pg_stat_progress_create_index` — ?
- `ds: pg_stat_progress_vacuum` — ?
- `ds: pg_stat_recovery_prefetch` — ?
- `ds: pg_stat_replication` — ?
- `cs: pg_stat_replication_slots` — ?
- `cs: pg_stat_slru` — ?
- `ds: pg_stat_ssl` — ?
- `ds: pg_stat_subscription` — ?
- `cs: pg_stat_subscription_stats` — ?
- `cs: pg_stat_sys_indexes` — ?
- `cs: pg_stat_sys_tables` — ?
- `cs: pg_stat_user_functions` — ?
- `cs: pg_stat_user_indexes` — ?
- `cs: pg_stat_user_tables` — ?
- `cs: pg_stat_wal` — ?
- `ds: pg_stat_wal_receiver` — ?
- `cs: pg_stat_xact_all_tables` — ?
- `cs: pg_stat_xact_sys_tables` — ?
- `cs: pg_stat_xact_user_functions` — ?
- `cs: pg_stat_xact_user_tables` — ?
- `cs: pg_statio_all_indexes` — ?
- `cs: pg_statio_all_sequences` — ?
- `cs: pg_statio_all_tables` — ?
- `cs: pg_statio_sys_indexes` — ?
- `cs: pg_statio_sys_sequences` — ?
- `cs: pg_statio_sys_tables` — ?
- `cs: pg_statio_user_indexes` — ?
- `cs: pg_statio_user_sequences` — ?
- `cs: pg_statio_user_tables` — ?
- `sc: pg_statistic` — ?
- `sc: pg_statistic_ext` — ?
- `sc: pg_statistic_ext_data` — ?
- `sv: pg_stats` — ?
- `sv: pg_stats_ext` — ?
- `sv: pg_stats_ext_exprs` — ?
- `sc: pg_subscription` — ?
- `sc: pg_subscription_rel` — ?
- `sv: pg_tables` — tables
- `sc: pg_tablespace` — ?
- `sv: pg_timezone_abbrevs`
- `sv: pg_timezone_names`
- `sc: pg_transform` — ?
- `sc: pg_trigger` — ?
- `sc: pg_ts_config` — ?
- `sc: pg_ts_config_map` — ?
- `sc: pg_ts_dict` — ?
- `sc: pg_ts_parser` — ?
- `sc: pg_ts_template` — ?
- `sc: pg_type` — ?
- `sv: pg_user` — ?
- `sc: pg_user_mapping` — ?
- `sv: pg_user_mappings` — ?
- `sv: pg_views` — ?
- `sv: pg_wait_events` — ?