pg_depend是postgres的一张系统表,用来记录数据库对象之间的依赖关系,除了常见的主外键,还有其他一些内部依赖关系,可以通过这个系统表呈现出来。
一、表结构:
postgres=# \d+ pg_depend
Table "pg_catalog.pg_depend"
Column | Type | Modifiers | Storage | Stats target | Description
-------------+---------+-----------+---------+--------------+-------------
classid | oid | not null | plain | | 系统OID
objid | oid | not null | plain | | 对象OID
objsubid | integer | not null | plain | |
refclassid | oid | not null | plain | | 引用系统OID
refobjid | oid | not null | plain | | 引用对象ID
refobjsubid | integer | not null | plain | |
deptype | "char" | not null | plain | | pg_depend类型
Indexes:
"pg_depend_depender_index" btree (classid, objid, objsubid)
"pg_depend_reference_index" btree (refclassid, refobjid, refobjsubid)
Has OIDs: no
--BTW:OID是Object Identifier的缩写,是对象ID的意思,因为是无符号的4字节类型,不够足够大,所以一般不用来做主键使用,仅系统内部,比如系统表等应用,可以与一些整型数字进行转换。与之相关的系统参数是default_with_oids,默认是off
postgres=# \d pg_constraint
Table "pg_catalog.pg_constraint"
Column | Type | Modifiers
---------------+--------------+-----------
c