SYSTEM CATALOGS / SYSTEM CATALOGS
pg_constraint
Read PG 18 manual ↗The catalog pg_constraint stores check, not-null, primary key, unique, foreign key, and exclusion constraints on tables.
- Kind
- System catalogs
- Columns in this snapshot
- 28
- Definition source
- English manual
Columns 28
| Column | Type | Description / reference |
|---|---|---|
oid | oid | Row identifier |
conname | name | Constraint name (not necessarily unique!) |
connamespace | oid | The OID of the namespace that contains this constraint pg_namespace.oid |
contype | char | 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 | bool | Is the constraint deferrable? |
condeferred | bool | Is the constraint deferred by default? |
conenforced | bool | Is the constraint enforced? |
convalidated | bool | Has the constraint been validated? |
conrelid | oid | The table this constraint is on; zero if not a table constraint pg_class.oid |
contypid | oid | The domain this constraint is on; zero if not a domain constraint pg_type.oid |
conindid | oid | The index supporting this constraint, if it's a unique, primary key, foreign key, or exclusion constraint; else zero pg_class.oid |
conparentid | oid | The corresponding constraint of the parent partitioned table, if this is a constraint on a partition; else zero |
confrelid | oid | If a foreign key, the referenced table; else zero pg_class.oid |
confupdtype | char | Foreign key update action code: a = no action, r = restrict, c = cascade, n = set null, d = set default |
confdeltype | char | Foreign key deletion action code: a = no action, r = restrict, c = cascade, n = set null, d = set default |
confmatchtype | char | Foreign key match type: f = full, p = partial, s = simple |
conislocal | bool | This constraint is defined locally for the relation. Note that a constraint can be locally defined and inherited simultaneously. |
coninhcount | int2 | The number of direct inheritance ancestors this constraint has. A constraint with a nonzero number of ancestors cannot be dropped nor renamed. |
connoinherit | bool | This constraint is defined locally for the relation. It is a non-inheritable constraint. |
conperiod | bool | 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
| Column | 9.0 | 9.1 | 9.2 | 9.3 | 9.4 | 9.5 | 9.6 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
oid | · | · | · | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
conname | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
connamespace | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
contype | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
condeferrable | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
condeferred | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
convalidated | · | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
conrelid | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
contypid | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
conindid | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
confrelid | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
confupdtype | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
confdeltype | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
confmatchtype | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
conislocal | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
coninhcount | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
connoinherit | · | · | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
conkey | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
confkey | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
conpfeqop | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
conppeqop | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
conffeqop | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
conexclop | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
conbin | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
consrc | ● | ● | ● | ● | ● | ● | ● | ● | ● | · | · | · | · | · | · | · | · | · |
conparentid | · | · | · | · | · | · | · | · | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
confdelsetcols | · | · | · | · | · | · | · | · | · | · | · | · | ● | ● | ● | ● | ● | ● |
conenforced | · | · | · | · | · | · | · | · | · | · | · | · | · | · | · | ● | ● | ● |
conperiod | · | · | · | · | · | · | · | · | · | · | · | · | · | · | · | ● | ● | ● |
Version history 10
- PG 17 → 18changed
- PG 16 → 17changed
- PG 15 → 16changed
- PG 14 → 15changed
- PG 13 → 14changed
- PG 11 → 12changed
- PG 10 → 11changed
- PG 9.2 → 9.3changed
- PG 9.1 → 9.2changed
- PG 9.0 → 9.1changed
Definition snapshot: english-manuals:a2e0e946481539aff9188c26fe5… · English manual source