System Catalogs / System catalogs
pg_constraint
Read the PG 18 manualThe catalog pg_constraint stores check, not-null, primary key, unique, foreign key, and exclusion constraints on tables.
Reading PG 18current·documented in 24 of 24 versions, 7.4 to 20
- Kind
- System catalogs
- Columns in this snapshot
- 28
- Definition source
- English manual
- Metadata snapshot
- 18.6
Columns 28
As listed in the PostgreSQL 18 manual.
| Column | Type | Description / reference |
|---|---|---|
oid | oidNOT NULL | Row identifier |
conname | nameNOT NULL | Constraint name (not necessarily unique!) |
connamespace | oidNOT NULL | The OID of the namespace that contains this constraint pg_namespace.oid |
contype | charNOT NULL | c = check constraint, f = foreign key constraint, n = not-null constraint, p = primary key constraint, u = unique constraint, t = constraint trigger, x = exclusion constraint |
condeferrable | boolNOT NULL | Is the constraint deferrable? |
condeferred | boolNOT NULL | Is the constraint deferred by default? |
conenforced | boolNOT NULL | Is the constraint enforced? |
convalidated | boolNOT NULL | Has the constraint been validated? |
conrelid | oidNOT NULL | The table this constraint is on; zero if not a table constraint pg_class.oid |
contypid | oidNOT NULL | The domain this constraint is on; zero if not a domain constraint pg_type.oid |
conindid | oidNOT NULL | The index supporting this constraint, if it's a unique, primary key, foreign key, or exclusion constraint; else zero pg_class.oid |
conparentid | oidNOT NULL | The corresponding constraint of the parent partitioned table, if this is a constraint on a partition; else zero pg_constraint.oid |
confrelid | oidNOT NULL | If a foreign key, the referenced table; else zero pg_class.oid |
confupdtype | charNOT NULL | Foreign key update action code: a = no action, r = restrict, c = cascade, n = set null, d = set default |
confdeltype | charNOT NULL | Foreign key deletion action code: a = no action, r = restrict, c = cascade, n = set null, d = set default |
confmatchtype | charNOT NULL | Foreign key match type: f = full, p = partial, s = simple |
conislocal | boolNOT NULL | This constraint is defined locally for the relation. Note that a constraint can be locally defined and inherited simultaneously. |
coninhcount | int2NOT NULL | The number of direct inheritance ancestors this constraint has. A constraint with a nonzero number of ancestors cannot be dropped nor renamed. |
connoinherit | boolNOT NULL | This constraint is defined locally for the relation. It is a non-inheritable constraint. |
conperiod | boolNOT NULL | This constraint is defined with WITHOUT OVERLAPS (for primary keys and unique constraints) or PERIOD (for foreign keys). |
conkey | int2[] | If a table constraint (including foreign keys, but not constraint triggers), list of the constrained columns pg_attribute.attnum |
confkey | int2[] | If a foreign key, list of the referenced columns pg_attribute.attnum |
conpfeqop | oid[] | If a foreign key, list of the equality operators for PK = FK comparisons pg_operator.oid |
conppeqop | oid[] | If a foreign key, list of the equality operators for PK = PK comparisons pg_operator.oid |
conffeqop | oid[] | If a foreign key, list of the equality operators for FK = FK comparisons pg_operator.oid |
confdelsetcols | int2[] | If a foreign key with a SET NULL or SET DEFAULT delete action, the columns that will be updated. If null, all of the referencing columns will be updated. pg_attribute.attnum |
conexclop | oid[] | If an exclusion constraint or WITHOUT OVERLAPS primary key/unique constraint, list of the per-column exclusion operators. pg_operator.oid |
conbin | pg_node_tree | If a check constraint, an internal representation of the expression. (It's recommended to use pg_get_constraintdef() to extract the definition of a check constraint.) |
Column history across versions
Version history 13
Definition snapshot: english-manuals:3228acb54b2d8175450a80630d8… · English manual source