pg_constraint
用于存储约束信息的系统表
pg_constraint 是一个 系统目录 表,用于存储有关约束(不包括 NOT NULL 约束)的信息。
pg_constraint 在 PostgreSQL 7.3 中被添加。
用法
系统函数
可以使用系统函数 pg_get_constraintdef() 来获取约束的定义。
实现与可能的更改
非空约束 (NOT NULL constraints)
在 PostgreSQL 18 之前,NOT NULL 约束存储在 pg_attribute 中。
域约束 (Domain constraints)
提交 8abb3cda (来自 2015 年) 包含一项建议,即为 域 约束添加一个单独的表。
按 PostgreSQL 版本定义
pg_constraint (PostgreSQL 19)
Table "pg_catalog.pg_constraint"
Column | Type | Collation | Nullable | Default
----------------+--------------+-----------+----------+---------
oid | oid | | not null |
conname | name | | not null |
connamespace | oid | | not null |
contype | "char" | | not null |
condeferrable | boolean | | not null |
condeferred | boolean | | not null |
conenforced | boolean | | not null |
convalidated | boolean | | not null |
conrelid | oid | | not null |
contypid | oid | | not null |
conindid | oid | | not null |
conparentid | oid | | not null |
confrelid | oid | | not null |
confupdtype | "char" | | not null |
confdeltype | "char" | | not null |
confmatchtype | "char" | | not null |
conislocal | boolean | | not null |
coninhcount | smallint | | not null |
connoinherit | boolean | | not null |
conperiod | boolean | | not null |
conkey | smallint[] | | |
confkey | smallint[] | | |
conpfeqop | oid[] | | |
conppeqop | oid[] | | |
conffeqop | oid[] | | |
confdelsetcols | smallint[] | | |
conexclop | oid[] | | |
conbin | pg_node_tree | C | |
Indexes:
"pg_constraint_oid_index" PRIMARY KEY, btree (oid)
"pg_constraint_conname_nsp_index" btree (conname, connamespace)
"pg_constraint_conparentid_index" btree (conparentid)
"pg_constraint_conrelid_contypid_conname_index" UNIQUE CONSTRAINT, btree (conrelid, contypid, conname)
"pg_constraint_contypid_index" btree (contypid)
文档: pg_constraint
pg_constraint (PostgreSQL 18)
Table "pg_catalog.pg_constraint"
Column | Type | Collation | Nullable | Default
----------------+--------------+-----------+----------+---------
oid | oid | | not null |
conname | name | | not null |
connamespace | oid | | not null |
contype | "char" | | not null |
condeferrable | boolean | | not null |
condeferred | boolean | | not null |
conenforced | boolean | | not null |
convalidated | boolean | | not null |
conrelid | oid | | not null |
contypid | oid | | not null |
conindid | oid | | not null |
conparentid | oid | | not null |
confrelid | oid | | not null |
confupdtype | "char" | | not null |
confdeltype | "char" | | not null |
confmatchtype | "char" | | not null |
conislocal | boolean | | not null |
coninhcount | smallint | | not null |
connoinherit | boolean | | not null |
conperiod | boolean | | not null |
conkey | smallint[] | | |
confkey | smallint[] | | |
conpfeqop | oid[] | | |
conppeqop | oid[] | | |
conffeqop | oid[] | | |
confdelsetcols | smallint[] | | |
conexclop | oid[] | | |
conbin | pg_node_tree | C | |
Indexes:
"pg_constraint_oid_index" PRIMARY KEY, btree (oid)
"pg_constraint_conname_nsp_index" btree (conname, connamespace)
"pg_constraint_conparentid_index" btree (conparentid)
"pg_constraint_conrelid_contypid_conname_index" UNIQUE CONSTRAINT, btree (conrelid, contypid, conname)
"pg_constraint_contypid_index" btree (contypid)
文档: pg_constraint
pg_constraint (PostgreSQL 17)
Table "pg_catalog.pg_constraint"
Column | Type | Collation | Nullable | Default
----------------+--------------+-----------+----------+---------
oid | oid | | not null |
conname | name | | not null |
connamespace | oid | | not null |
contype | "char" | | not null |
condeferrable | boolean | | not null |
condeferred | boolean | | not null |
convalidated | boolean | | not null |
conrelid | oid | | not null |
contypid | oid | | not null |
conindid | oid | | not null |
conparentid | oid | | not null |
confrelid | oid | | not null |
confupdtype | "char" | | not null |
confdeltype | "char" | | not null |
confmatchtype | "char" | | not null |
conislocal | boolean | | not null |
coninhcount | smallint | | not null |
connoinherit | boolean | | not null |
conkey | smallint[] | | |
confkey | smallint[] | | |
conpfeqop | oid[] | | |
conppeqop | oid[] | | |
conffeqop | oid[] | | |
confdelsetcols | smallint[] | | |
conexclop | oid[] | | |
conbin | pg_node_tree | C | |
Indexes:
"pg_constraint_oid_index" PRIMARY KEY, btree (oid)
"pg_constraint_conname_nsp_index" btree (conname, connamespace)
"pg_constraint_conparentid_index" btree (conparentid)
"pg_constraint_conrelid_contypid_conname_index" UNIQUE CONSTRAINT, btree (conrelid, contypid, conname)
"pg_constraint_contypid_index" btree (contypid)
文档: pg_constraint
pg_constraint (PostgreSQL 16)
Table "pg_catalog.pg_constraint"
Column | Type | Collation | Nullable | Default
----------------+--------------+-----------+----------+---------
oid | oid | | not null |
conname | name | | not null |
connamespace | oid | | not null |
contype | "char" | | not null |
condeferrable | boolean | | not null |
condeferred | boolean | | not null |
convalidated | boolean | | not null |
conrelid | oid | | not null |
contypid | oid | | not null |
conindid | oid | | not null |
conparentid | oid | | not null |
confrelid | oid | | not null |
confupdtype | "char" | | not null |
confdeltype | "char" | | not null |
confmatchtype | "char" | | not null |
conislocal | boolean | | not null |
coninhcount | smallint | | not null |
connoinherit | boolean | | not null |
conkey | smallint[] | | |
confkey | smallint[] | | |
conpfeqop | oid[] | | |
conppeqop | oid[] | | |
conffeqop | oid[] | | |
confdelsetcols | smallint[] | | |
conexclop | oid[] | | |
conbin | pg_node_tree | C | |
Indexes:
"pg_constraint_oid_index" PRIMARY KEY, btree (oid)
"pg_constraint_conname_nsp_index" btree (conname, connamespace)
"pg_constraint_conparentid_index" btree (conparentid)
"pg_constraint_conrelid_contypid_conname_index" UNIQUE CONSTRAINT, btree (conrelid, contypid, conname)
"pg_constraint_contypid_index" btree (contypid)
文档: pg_constraint
pg_constraint (PostgreSQL 15)
Table "pg_catalog.pg_constraint"
Column | Type | Collation | Nullable | Default
----------------+--------------+-----------+----------+---------
oid | oid | | not null |
conname | name | | not null |
connamespace | oid | | not null |
contype | "char" | | not null |
condeferrable | boolean | | not null |
condeferred | boolean | | not null |
convalidated | boolean | | not null |
conrelid | oid | | not null |
contypid | oid | | not null |
conindid | oid | | not null |
conparentid | oid | | not null |
confrelid | oid | | not null |
confupdtype | "char" | | not null |
confdeltype | "char" | | not null |
confmatchtype | "char" | | not null |
conislocal | boolean | | not null |
coninhcount | integer | | not null |
connoinherit | boolean | | not null |
conkey | smallint[] | | |
confkey | smallint[] | | |
conpfeqop | oid[] | | |
conppeqop | oid[] | | |
conffeqop | oid[] | | |
confdelsetcols | smallint[] | | |
conexclop | oid[] | | |
conbin | pg_node_tree | C | |
Indexes:
"pg_constraint_oid_index" PRIMARY KEY, btree (oid)
"pg_constraint_conname_nsp_index" btree (conname, connamespace)
"pg_constraint_conparentid_index" btree (conparentid)
"pg_constraint_conrelid_contypid_conname_index" UNIQUE CONSTRAINT, btree (conrelid, contypid, conname)
"pg_constraint_contypid_index" btree (contypid)
文档: pg_constraint
pg_constraint (PostgreSQL 14)
Table "pg_catalog.pg_constraint"
Column | Type | Collation | Nullable | Default
---------------+--------------+-----------+----------+---------
oid | oid | | not null |
conname | name | | not null |
connamespace | oid | | not null |
contype | "char" | | not null |
condeferrable | boolean | | not null |
condeferred | boolean | | not null |
convalidated | boolean | | not null |
conrelid | oid | | not null |
contypid | oid | | not null |
conindid | oid | | not null |
conparentid | oid | | not null |
confrelid | oid | | not null |
confupdtype | "char" | | not null |
confdeltype | "char" | | not null |
confmatchtype | "char" | | not null |
conislocal | boolean | | not null |
coninhcount | integer | | not null |
connoinherit | boolean | | not null |
conkey | smallint[] | | |
confkey | smallint[] | | |
conpfeqop | oid[] | | |
conppeqop | oid[] | | |
conffeqop | oid[] | | |
conexclop | oid[] | | |
conbin | pg_node_tree | C | |
Indexes:
"pg_constraint_oid_index" PRIMARY KEY, btree (oid)
"pg_constraint_conname_nsp_index" btree (conname, connamespace)
"pg_constraint_conparentid_index" btree (conparentid)
"pg_constraint_conrelid_contypid_conname_index" UNIQUE CONSTRAINT, btree (conrelid, contypid, conname)
"pg_constraint_contypid_index" btree (contypid)
文档: pg_constraint
pg_constraint (PostgreSQL 13)
Table "pg_catalog.pg_constraint"
Column | Type | Collation | Nullable | Default
---------------+--------------+-----------+----------+---------
oid | oid | | not null |
conname | name | | not null |
connamespace | oid | | not null |
contype | "char" | | not null |
condeferrable | boolean | | not null |
condeferred | boolean | | not null |
convalidated | boolean | | not null |
conrelid | oid | | not null |
contypid | oid | | not null |
conindid | oid | | not null |
conparentid | oid | | not null |
confrelid | oid | | not null |
confupdtype | "char" | | not null |
confdeltype | "char" | | not null |
confmatchtype | "char" | | not null |
conislocal | boolean | | not null |
coninhcount | integer | | not null |
connoinherit | boolean | | not null |
conkey | smallint[] | | |
confkey | smallint[] | | |
conpfeqop | oid[] | | |
conppeqop | oid[] | | |
conffeqop | oid[] | | |
conexclop | oid[] | | |
conbin | pg_node_tree | C | |
Indexes:
"pg_constraint_conname_nsp_index" btree (conname, connamespace)
"pg_constraint_conparentid_index" btree (conparentid)
"pg_constraint_conrelid_contypid_conname_index" UNIQUE, btree (conrelid, contypid, conname)
"pg_constraint_contypid_index" btree (contypid)
"pg_constraint_oid_index" UNIQUE, btree (oid)
文档: pg_constraint
pg_constraint (PostgreSQL 12)
Table "pg_catalog.pg_constraint"
Column | Type | Collation | Nullable | Default
---------------+--------------+-----------+----------+---------
oid | oid | | not null |
conname | name | | not null |
connamespace | oid | | not null |
contype | "char" | | not null |
condeferrable | boolean | | not null |
condeferred | boolean | | not null |
convalidated | boolean | | not null |
conrelid | oid | | not null |
contypid | oid | | not null |
conindid | oid | | not null |
conparentid | oid | | not null |
confrelid | oid | | not null |
confupdtype | "char" | | not null |
confdeltype | "char" | | not null |
confmatchtype | "char" | | not null |
conislocal | boolean | | not null |
coninhcount | integer | | not null |
connoinherit | boolean | | not null |
conkey | smallint[] | | |
confkey | smallint[] | | |
conpfeqop | oid[] | | |
conppeqop | oid[] | | |
conffeqop | oid[] | | |
conexclop | oid[] | | |
conbin | pg_node_tree | C | |
Indexes:
"pg_constraint_conrelid_contypid_conname_index" UNIQUE, btree (conrelid, contypid, conname)
"pg_constraint_oid_index" UNIQUE, btree (oid)
"pg_constraint_conname_nsp_index" btree (conname, connamespace)
"pg_constraint_conparentid_index" btree (conparentid)
"pg_constraint_contypid_index" btree (contypid)
文档: pg_constraint
pg_constraint (PostgreSQL 11)
Table "pg_catalog.pg_constraint"
Column | Type | Collation | Nullable | Default
---------------+--------------+-----------+----------+---------
conname | name | | not null |
connamespace | oid | | not null |
contype | "char" | | not null |
condeferrable | boolean | | not null |
condeferred | boolean | | not null |
convalidated | boolean | | not null |
conrelid | oid | | not null |
contypid | oid | | not null |
conindid | oid | | not null |
conparentid | oid | | not null |
confrelid | oid | | not null |
confupdtype | "char" | | not null |
confdeltype | "char" | | not null |
confmatchtype | "char" | | not null |
conislocal | boolean | | not null |
coninhcount | integer | | not null |
connoinherit | boolean | | not null |
conkey | smallint[] | | |
confkey | smallint[] | | |
conpfeqop | oid[] | | |
conppeqop | oid[] | | |
conffeqop | oid[] | | |
conexclop | oid[] | | |
conbin | pg_node_tree | | |
consrc | text | | |
Indexes:
"pg_constraint_conrelid_contypid_conname_index" UNIQUE, btree (conrelid, contypid, conname)
"pg_constraint_oid_index" UNIQUE, btree (oid)
"pg_constraint_conname_nsp_index" btree (conname, connamespace)
"pg_constraint_conparentid_index" btree (conparentid)
"pg_constraint_contypid_index" btree (contypid)
文档: pg_constraint
pg_constraint (PostgreSQL 10)
Table "pg_catalog.pg_constraint"
Column | Type | Collation | Nullable | Default
---------------+--------------+-----------+----------+---------
conname | name | | not null |
connamespace | oid | | not null |
contype | "char" | | not null |
condeferrable | boolean | | not null |
condeferred | boolean | | not null |
convalidated | boolean | | not null |
conrelid | oid | | not null |
contypid | oid | | not null |
conindid | oid | | not null |
confrelid | oid | | not null |
confupdtype | "char" | | not null |
confdeltype | "char" | | not null |
confmatchtype | "char" | | not null |
conislocal | boolean | | not null |
coninhcount | integer | | not null |
connoinherit | boolean | | not null |
conkey | smallint[] | | |
confkey | smallint[] | | |
conpfeqop | oid[] | | |
conppeqop | oid[] | | |
conffeqop | oid[] | | |
conexclop | oid[] | | |
conbin | pg_node_tree | | |
consrc | text | | |
Indexes:
"pg_constraint_oid_index" UNIQUE, btree (oid)
"pg_constraint_conname_nsp_index" btree (conname, connamespace)
"pg_constraint_conrelid_index" btree (conrelid)
"pg_constraint_contypid_index" btree (contypid)
文档: pg_constraint
pg_constraint (PostgreSQL 9.6)
Table "pg_catalog.pg_constraint"
Column | Type | Modifiers
---------------+--------------+-----------
conname | name | not null
connamespace | oid | not null
contype | "char" | not null
condeferrable | boolean | not null
condeferred | boolean | not null
convalidated | boolean | not null
conrelid | oid | not null
contypid | oid | not null
conindid | oid | not null
confrelid | oid | not null
confupdtype | "char" | not null
confdeltype | "char" | not null
confmatchtype | "char" | not null
conislocal | boolean | not null
coninhcount | integer | not null
connoinherit | boolean | not null
conkey | smallint[] |
confkey | smallint[] |
conpfeqop | oid[] |
conppeqop | oid[] |
conffeqop | oid[] |
conexclop | oid[] |
conbin | pg_node_tree |
consrc | text |
Indexes:
"pg_constraint_oid_index" UNIQUE, btree (oid)
"pg_constraint_conname_nsp_index" btree (conname, connamespace)
"pg_constraint_conrelid_index" btree (conrelid)
"pg_constraint_contypid_index" btree (contypid)
文档: pg_constraint
pg_constraint (PostgreSQL 9.5)
Table "pg_catalog.pg_constraint"
Column | Type | Modifiers
---------------+--------------+-----------
conname | name | not null
connamespace | oid | not null
contype | "char" | not null
condeferrable | boolean | not null
condeferred | boolean | not null
convalidated | boolean | not null
conrelid | oid | not null
contypid | oid | not null
conindid | oid | not null
confrelid | oid | not null
confupdtype | "char" | not null
confdeltype | "char" | not null
confmatchtype | "char" | not null
conislocal | boolean | not null
coninhcount | integer | not null
connoinherit | boolean | not null
conkey | smallint[] |
confkey | smallint[] |
conpfeqop | oid[] |
conppeqop | oid[] |
conffeqop | oid[] |
conexclop | oid[] |
conbin | pg_node_tree |
consrc | text |
Indexes:
"pg_constraint_oid_index" UNIQUE, btree (oid)
"pg_constraint_conname_nsp_index" btree (conname, connamespace)
"pg_constraint_conrelid_index" btree (conrelid)
"pg_constraint_contypid_index" btree (contypid)
文档: pg_constraint
pg_constraint (PostgreSQL 9.4)
Table "pg_catalog.pg_constraint"
Column | Type | Modifiers
---------------+--------------+-----------
conname | name | not null
connamespace | oid | not null
contype | "char" | not null
condeferrable | boolean | not null
condeferred | boolean | not null
convalidated | boolean | not null
conrelid | oid | not null
contypid | oid | not null
conindid | oid | not null
confrelid | oid | not null
confupdtype | "char" | not null
confdeltype | "char" | not null
confmatchtype | "char" | not null
conislocal | boolean | not null
coninhcount | integer | not null
connoinherit | boolean | not null
conkey | smallint[] |
confkey | smallint[] |
conpfeqop | oid[] |
conppeqop | oid[] |
conffeqop | oid[] |
conexclop | oid[] |
conbin | pg_node_tree |
consrc | text |
Indexes:
"pg_constraint_oid_index" UNIQUE, btree (oid)
"pg_constraint_conname_nsp_index" btree (conname, connamespace)
"pg_constraint_conrelid_index" btree (conrelid)
"pg_constraint_contypid_index" btree (contypid)
文档: pg_constraint
pg_constraint (PostgreSQL 9.3)
Table "pg_catalog.pg_constraint"
Column | Type | Modifiers
---------------+--------------+-----------
conname | name | not null
connamespace | oid | not null
contype | "char" | not null
condeferrable | boolean | not null
condeferred | boolean | not null
convalidated | boolean | not null
conrelid | oid | not null
contypid | oid | not null
conindid | oid | not null
confrelid | oid | not null
confupdtype | "char" | not null
confdeltype | "char" | not null
confmatchtype | "char" | not null
conislocal | boolean | not null
coninhcount | integer | not null
connoinherit | boolean | not null
conkey | smallint[] |
confkey | smallint[] |
conpfeqop | oid[] |
conppeqop | oid[] |
conffeqop | oid[] |
conexclop | oid[] |
conbin | pg_node_tree |
consrc | text |
Indexes:
"pg_constraint_oid_index" UNIQUE, btree (oid)
"pg_constraint_conname_nsp_index" btree (conname, connamespace)
"pg_constraint_conrelid_index" btree (conrelid)
"pg_constraint_contypid_index" btree (contypid)
文档: pg_constraint
pg_constraint (PostgreSQL 9.2)
Table "pg_catalog.pg_constraint"
Column | Type | Modifiers
---------------+--------------+-----------
conname | name | not null
connamespace | oid | not null
contype | "char" | not null
condeferrable | boolean | not null
condeferred | boolean | not null
convalidated | boolean | not null
conrelid | oid | not null
contypid | oid | not null
conindid | oid | not null
confrelid | oid | not null
confupdtype | "char" | not null
confdeltype | "char" | not null
confmatchtype | "char" | not null
conislocal | boolean | not null
coninhcount | integer | not null
connoinherit | boolean | not null
conkey | smallint[] |
confkey | smallint[] |
conpfeqop | oid[] |
conppeqop | oid[] |
conffeqop | oid[] |
conexclop | oid[] |
conbin | pg_node_tree |
consrc | text |
Indexes:
"pg_constraint_oid_index" UNIQUE, btree (oid)
"pg_constraint_conname_nsp_index" btree (conname, connamespace)
"pg_constraint_conrelid_index" btree (conrelid)
"pg_constraint_contypid_index" btree (contypid)
文档: pg_constraint
pg_constraint (PostgreSQL 9.1)
Table "pg_catalog.pg_constraint"
Column | Type | Modifiers
---------------+--------------+-----------
conname | name | not null
connamespace | oid | not null
contype | "char" | not null
condeferrable | boolean | not null
condeferred | boolean | not null
convalidated | boolean | not null
conrelid | oid | not null
contypid | oid | not null
conindid | oid | not null
confrelid | oid | not null
confupdtype | "char" | not null
confdeltype | "char" | not null
confmatchtype | "char" | not null
conislocal | boolean | not null
coninhcount | integer | not null
conkey | smallint[] |
confkey | smallint[] |
conpfeqop | oid[] |
conppeqop | oid[] |
conffeqop | oid[] |
conexclop | oid[] |
conbin | pg_node_tree |
consrc | text |
Indexes:
"pg_constraint_oid_index" UNIQUE, btree (oid)
"pg_constraint_conname_nsp_index" btree (conname, connamespace)
"pg_constraint_conrelid_index" btree (conrelid)
"pg_constraint_contypid_index" btree (contypid)
文档: pg_constraint
pg_constraint (PostgreSQL 9.0)
Table "pg_catalog.pg_constraint"
Column | Type | Modifiers
---------------+------------+-----------
conname | name | not null
connamespace | oid | not null
contype | "char" | not null
condeferrable | boolean | not null
condeferred | boolean | not null
conrelid | oid | not null
contypid | oid | not null
conindid | oid | not null
confrelid | oid | not null
confupdtype | "char" | not null
confdeltype | "char" | not null
confmatchtype | "char" | not null
conislocal | boolean | not null
coninhcount | integer | not null
conkey | smallint[] |
confkey | smallint[] |
conpfeqop | oid[] |
conppeqop | oid[] |
conffeqop | oid[] |
conexclop | oid[] |
conbin | text |
consrc | text |
Indexes:
"pg_constraint_oid_index" UNIQUE, btree (oid)
"pg_constraint_conname_nsp_index" btree (conname, connamespace)
"pg_constraint_conrelid_index" btree (conrelid)
"pg_constraint_contypid_index" btree (contypid)
文档: pg_constraint
pg_constraint (PostgreSQL 8.4)
Table "pg_catalog.pg_constraint"
Column | Type | Modifiers
---------------+------------+-----------
conname | name | not null
connamespace | oid | not null
contype | "char" | not null
condeferrable | boolean | not null
condeferred | boolean | not null
conrelid | oid | not null
contypid | oid | not null
confrelid | oid | not null
confupdtype | "char" | not null
confdeltype | "char" | not null
confmatchtype | "char" | not null
conislocal | boolean | not null
coninhcount | integer | not null
conkey | smallint[] |
confkey | smallint[] |
conpfeqop | oid[] |
conppeqop | oid[] |
conffeqop | oid[] |
conbin | text |
consrc | text |
Indexes:
"pg_constraint_oid_index" UNIQUE, btree (oid)
"pg_constraint_conname_nsp_index" btree (conname, connamespace)
"pg_constraint_conrelid_index" btree (conrelid)
"pg_constraint_contypid_index" btree (contypid)
文档: pg_constraint
pg_constraint (PostgreSQL 8.3)
Table "pg_catalog.pg_constraint"
Column | Type | Modifiers
---------------+------------+-----------
conname | name | not null
connamespace | oid | not null
contype | "char" | not null
condeferrable | boolean | not null
condeferred | boolean | not null
conrelid | oid | not null
contypid | oid | not null
confrelid | oid | not null
confupdtype | "char" | not null
confdeltype | "char" | not null
confmatchtype | "char" | not null
conkey | smallint[] |
confkey | smallint[] |
conpfeqop | oid[] |
conppeqop | oid[] |
conffeqop | oid[] |
conbin | text |
consrc | text |
Indexes:
"pg_constraint_oid_index" UNIQUE, btree (oid)
"pg_constraint_conname_nsp_index" btree (conname, connamespace)
"pg_constraint_conrelid_index" btree (conrelid)
"pg_constraint_contypid_index" btree (contypid)
文档: pg_constraint
pg_constraint (PostgreSQL 8.2)
Table "pg_catalog.pg_constraint"
Column | Type | Modifiers
---------------+------------+-----------
conname | name | not null
connamespace | oid | not null
contype | "char" | not null
condeferrable | boolean | not null
condeferred | boolean | not null
conrelid | oid | not null
contypid | oid | not null
confrelid | oid | not null
confupdtype | "char" | not null
confdeltype | "char" | not null
confmatchtype | "char" | not null
conkey | smallint[] |
confkey | smallint[] |
conbin | text |
consrc | text |
Indexes:
"pg_constraint_oid_index" UNIQUE, btree (oid)
"pg_constraint_conname_nsp_index" btree (conname, connamespace)
"pg_constraint_conrelid_index" btree (conrelid)
"pg_constraint_contypid_index" btree (contypid)
文档: pg_constraint
变更历史
- PostgreSQL 18
- PostgreSQL 16
- 列
coninhcount从INTEGER更改为SMALLINT(提交 90189eef)
- 列
- PostgreSQL 15
- 添加了列
confdelsetcols(提交 d6f96ed9)
- 添加了列
- PostgreSQL 12
- 移除了列
consrc(提交 96b00c43)
- 移除了列
- PostgreSQL 9.3
- 列
confmatchtype: 默认外键匹配样式现在是MATCH SIMPLE(提交 f5297bdf)
- 列
- PostgreSQL 9.2
- 列
conisonly重命名为connoinherit(提交 09ff76fc)
- 列
- PostgreSQL 9.0
- 添加了列
conindid(提交 c1b9ec24)
- 添加了列
- PostgreSQL 8.4
- 添加了列
conislocal和coninhcount(提交 cd902b33)
- 添加了列
- PostgreSQL 8.3
- 添加了列
conpfeqop、conppeqop和conffeqop(提交 7bddca34)
- 添加了列
- PostgreSQL 7.3
- 添加 (提交 7c6df91d)
参考资料
- PostgreSQL 文档: pg_constraint
