pg_trigger
是一个用于存储触发器信息的系统目录表。
pg_trigger
添加于PostgreSQL 6.2。
按 PostgreSQL 版本定义
pg_trigger (PostgreSQL 17)
Table "pg_catalog.pg_trigger" Column | Type | Collation | Nullable | Default ----------------+--------------+-----------+----------+--------- oid | oid | | not null | tgrelid | oid | | not null | tgparentid | oid | | not null | tgname | name | | not null | tgfoid | oid | | not null | tgtype | smallint | | not null | tgenabled | "char" | | not null | tgisinternal | boolean | | not null | tgconstrrelid | oid | | not null | tgconstrindid | oid | | not null | tgconstraint | oid | | not null | tgdeferrable | boolean | | not null | tginitdeferred | boolean | | not null | tgnargs | smallint | | not null | tgattr | int2vector | | not null | tgargs | bytea | | not null | tgqual | pg_node_tree | C | | tgoldtable | name | | | tgnewtable | name | | | Indexes: "pg_trigger_oid_index" PRIMARY KEY, btree (oid) "pg_trigger_tgconstraint_index" btree (tgconstraint) "pg_trigger_tgrelid_tgname_index" UNIQUE CONSTRAINT, btree (tgrelid, tgname)
文档: pg_trigger
pg_trigger (PostgreSQL 16)
Table "pg_catalog.pg_trigger" Column | Type | Collation | Nullable | Default ----------------+--------------+-----------+----------+--------- oid | oid | | not null | tgrelid | oid | | not null | tgparentid | oid | | not null | tgname | name | | not null | tgfoid | oid | | not null | tgtype | smallint | | not null | tgenabled | "char" | | not null | tgisinternal | boolean | | not null | tgconstrrelid | oid | | not null | tgconstrindid | oid | | not null | tgconstraint | oid | | not null | tgdeferrable | boolean | | not null | tginitdeferred | boolean | | not null | tgnargs | smallint | | not null | tgattr | int2vector | | not null | tgargs | bytea | | not null | tgqual | pg_node_tree | C | | tgoldtable | name | | | tgnewtable | name | | | Indexes: "pg_trigger_oid_index" PRIMARY KEY, btree (oid) "pg_trigger_tgconstraint_index" btree (tgconstraint) "pg_trigger_tgrelid_tgname_index" UNIQUE CONSTRAINT, btree (tgrelid, tgname)
文档: pg_trigger
pg_trigger (PostgreSQL 15)
Table "pg_catalog.pg_trigger" Column | Type | Collation | Nullable | Default ----------------+--------------+-----------+----------+--------- oid | oid | | not null | tgrelid | oid | | not null | tgparentid | oid | | not null | tgname | name | | not null | tgfoid | oid | | not null | tgtype | smallint | | not null | tgenabled | "char" | | not null | tgisinternal | boolean | | not null | tgconstrrelid | oid | | not null | tgconstrindid | oid | | not null | tgconstraint | oid | | not null | tgdeferrable | boolean | | not null | tginitdeferred | boolean | | not null | tgnargs | smallint | | not null | tgattr | int2vector | | not null | tgargs | bytea | | not null | tgqual | pg_node_tree | C | | tgoldtable | name | | | tgnewtable | name | | | Indexes: "pg_trigger_oid_index" PRIMARY KEY, btree (oid) "pg_trigger_tgconstraint_index" btree (tgconstraint) "pg_trigger_tgrelid_tgname_index" UNIQUE CONSTRAINT, btree (tgrelid, tgname)
文档: pg_trigger
pg_trigger (PostgreSQL 14)
Table "pg_catalog.pg_trigger" Column | Type | Collation | Nullable | Default ----------------+--------------+-----------+----------+--------- oid | oid | | not null | tgrelid | oid | | not null | tgparentid | oid | | not null | tgname | name | | not null | tgfoid | oid | | not null | tgtype | smallint | | not null | tgenabled | "char" | | not null | tgisinternal | boolean | | not null | tgconstrrelid | oid | | not null | tgconstrindid | oid | | not null | tgconstraint | oid | | not null | tgdeferrable | boolean | | not null | tginitdeferred | boolean | | not null | tgnargs | smallint | | not null | tgattr | int2vector | | not null | tgargs | bytea | | not null | tgqual | pg_node_tree | C | | tgoldtable | name | | | tgnewtable | name | | | Indexes: "pg_trigger_oid_index" PRIMARY KEY, btree (oid) "pg_trigger_tgconstraint_index" btree (tgconstraint) "pg_trigger_tgrelid_tgname_index" UNIQUE CONSTRAINT, btree (tgrelid, tgname)
文档: pg_trigger
pg_trigger (PostgreSQL 13)
Table "pg_catalog.pg_trigger" Column | Type | Collation | Nullable | Default ----------------+--------------+-----------+----------+--------- oid | oid | | not null | tgrelid | oid | | not null | tgparentid | oid | | not null | tgname | name | | not null | tgfoid | oid | | not null | tgtype | smallint | | not null | tgenabled | "char" | | not null | tgisinternal | boolean | | not null | tgconstrrelid | oid | | not null | tgconstrindid | oid | | not null | tgconstraint | oid | | not null | tgdeferrable | boolean | | not null | tginitdeferred | boolean | | not null | tgnargs | smallint | | not null | tgattr | int2vector | | not null | tgargs | bytea | | not null | tgqual | pg_node_tree | C | | tgoldtable | name | | | tgnewtable | name | | | Indexes: "pg_trigger_oid_index" UNIQUE, btree (oid) "pg_trigger_tgconstraint_index" btree (tgconstraint) "pg_trigger_tgrelid_tgname_index" UNIQUE, btree (tgrelid, tgname)
文档: pg_trigger
pg_trigger (PostgreSQL 12)
Table "pg_catalog.pg_trigger" Column | Type | Collation | Nullable | Default ----------------+--------------+-----------+----------+--------- oid | oid | | not null | tgrelid | oid | | not null | tgname | name | | not null | tgfoid | oid | | not null | tgtype | smallint | | not null | tgenabled | "char" | | not null | tgisinternal | boolean | | not null | tgconstrrelid | oid | | not null | tgconstrindid | oid | | not null | tgconstraint | oid | | not null | tgdeferrable | boolean | | not null | tginitdeferred | boolean | | not null | tgnargs | smallint | | not null | tgattr | int2vector | | not null | tgargs | bytea | | not null | tgqual | pg_node_tree | C | | tgoldtable | name | | | tgnewtable | name | | | Indexes: "pg_trigger_oid_index" UNIQUE, btree (oid) "pg_trigger_tgrelid_tgname_index" UNIQUE, btree (tgrelid, tgname) "pg_trigger_tgconstraint_index" btree (tgconstraint)
文档: pg_trigger
pg_trigger (PostgreSQL 11)
Table "pg_catalog.pg_trigger" Column | Type | Collation | Nullable | Default ----------------+--------------+-----------+----------+--------- tgrelid | oid | | not null | tgname | name | | not null | tgfoid | oid | | not null | tgtype | smallint | | not null | tgenabled | "char" | | not null | tgisinternal | boolean | | not null | tgconstrrelid | oid | | not null | tgconstrindid | oid | | not null | tgconstraint | oid | | not null | tgdeferrable | boolean | | not null | tginitdeferred | boolean | | not null | tgnargs | smallint | | not null | tgattr | int2vector | | not null | tgargs | bytea | | not null | tgqual | pg_node_tree | | | tgoldtable | name | | | tgnewtable | name | | | Indexes: "pg_trigger_oid_index" UNIQUE, btree (oid) "pg_trigger_tgrelid_tgname_index" UNIQUE, btree (tgrelid, tgname) "pg_trigger_tgconstraint_index" btree (tgconstraint)
文档: pg_trigger
pg_trigger (PostgreSQL 10)
Table "pg_catalog.pg_trigger" Column | Type | Collation | Nullable | Default ----------------+--------------+-----------+----------+--------- tgrelid | oid | | not null | tgname | name | | not null | tgfoid | oid | | not null | tgtype | smallint | | not null | tgenabled | "char" | | not null | tgisinternal | boolean | | not null | tgconstrrelid | oid | | not null | tgconstrindid | oid | | not null | tgconstraint | oid | | not null | tgdeferrable | boolean | | not null | tginitdeferred | boolean | | not null | tgnargs | smallint | | not null | tgattr | int2vector | | not null | tgargs | bytea | | not null | tgqual | pg_node_tree | | | tgoldtable | name | | | tgnewtable | name | | | Indexes: "pg_trigger_oid_index" UNIQUE, btree (oid) "pg_trigger_tgrelid_tgname_index" UNIQUE, btree (tgrelid, tgname) "pg_trigger_tgconstraint_index" btree (tgconstraint)
文档: pg_trigger
pg_trigger (PostgreSQL 9.6)
Table "pg_catalog.pg_trigger" Column | Type | Modifiers ----------------+--------------+----------- tgrelid | oid | not null tgname | name | not null tgfoid | oid | not null tgtype | smallint | not null tgenabled | "char" | not null tgisinternal | boolean | not null tgconstrrelid | oid | not null tgconstrindid | oid | not null tgconstraint | oid | not null tgdeferrable | boolean | not null tginitdeferred | boolean | not null tgnargs | smallint | not null tgattr | int2vector | not null tgargs | bytea | not null tgqual | pg_node_tree | Indexes: "pg_trigger_oid_index" UNIQUE, btree (oid) "pg_trigger_tgrelid_tgname_index" UNIQUE, btree (tgrelid, tgname) "pg_trigger_tgconstraint_index" btree (tgconstraint)
文档: pg_trigger
pg_trigger (PostgreSQL 9.5)
Table "pg_catalog.pg_trigger" Column | Type | Modifiers ----------------+--------------+----------- tgrelid | oid | not null tgname | name | not null tgfoid | oid | not null tgtype | smallint | not null tgenabled | "char" | not null tgisinternal | boolean | not null tgconstrrelid | oid | not null tgconstrindid | oid | not null tgconstraint | oid | not null tgdeferrable | boolean | not null tginitdeferred | boolean | not null tgnargs | smallint | not null tgattr | int2vector | not null tgargs | bytea | not null tgqual | pg_node_tree | Indexes: "pg_trigger_oid_index" UNIQUE, btree (oid) "pg_trigger_tgrelid_tgname_index" UNIQUE, btree (tgrelid, tgname) "pg_trigger_tgconstraint_index" btree (tgconstraint)
文档: pg_trigger
pg_trigger (PostgreSQL 9.4)
Table "pg_catalog.pg_trigger" Column | Type | Modifiers ----------------+--------------+----------- tgrelid | oid | not null tgname | name | not null tgfoid | oid | not null tgtype | smallint | not null tgenabled | "char" | not null tgisinternal | boolean | not null tgconstrrelid | oid | not null tgconstrindid | oid | not null tgconstraint | oid | not null tgdeferrable | boolean | not null tginitdeferred | boolean | not null tgnargs | smallint | not null tgattr | int2vector | not null tgargs | bytea | tgqual | pg_node_tree | Indexes: "pg_trigger_oid_index" UNIQUE, btree (oid) "pg_trigger_tgrelid_tgname_index" UNIQUE, btree (tgrelid, tgname) "pg_trigger_tgconstraint_index" btree (tgconstraint)
文档: pg_trigger
pg_trigger (PostgreSQL 9.3)
Table "pg_catalog.pg_trigger" Column | Type | Modifiers ----------------+--------------+----------- tgrelid | oid | not null tgname | name | not null tgfoid | oid | not null tgtype | smallint | not null tgenabled | "char" | not null tgisinternal | boolean | not null tgconstrrelid | oid | not null tgconstrindid | oid | not null tgconstraint | oid | not null tgdeferrable | boolean | not null tginitdeferred | boolean | not null tgnargs | smallint | not null tgattr | int2vector | not null tgargs | bytea | tgqual | pg_node_tree | Indexes: "pg_trigger_oid_index" UNIQUE, btree (oid) "pg_trigger_tgrelid_tgname_index" UNIQUE, btree (tgrelid, tgname) "pg_trigger_tgconstraint_index" btree (tgconstraint)
文档: pg_trigger
pg_trigger (PostgreSQL 9.2)
Table "pg_catalog.pg_trigger" Column | Type | Modifiers ----------------+--------------+----------- tgrelid | oid | not null tgname | name | not null tgfoid | oid | not null tgtype | smallint | not null tgenabled | "char" | not null tgisinternal | boolean | not null tgconstrrelid | oid | not null tgconstrindid | oid | not null tgconstraint | oid | not null tgdeferrable | boolean | not null tginitdeferred | boolean | not null tgnargs | smallint | not null tgattr | int2vector | not null tgargs | bytea | tgqual | pg_node_tree | Indexes: "pg_trigger_oid_index" UNIQUE, btree (oid) "pg_trigger_tgrelid_tgname_index" UNIQUE, btree (tgrelid, tgname) "pg_trigger_tgconstraint_index" btree (tgconstraint)
文档: pg_trigger
pg_trigger (PostgreSQL 9.1)
Table "pg_catalog.pg_trigger" Column | Type | Modifiers ----------------+--------------+----------- tgrelid | oid | not null tgname | name | not null tgfoid | oid | not null tgtype | smallint | not null tgenabled | "char" | not null tgisinternal | boolean | not null tgconstrrelid | oid | not null tgconstrindid | oid | not null tgconstraint | oid | not null tgdeferrable | boolean | not null tginitdeferred | boolean | not null tgnargs | smallint | not null tgattr | int2vector | not null tgargs | bytea | tgqual | pg_node_tree | Indexes: "pg_trigger_oid_index" UNIQUE, btree (oid) "pg_trigger_tgrelid_tgname_index" UNIQUE, btree (tgrelid, tgname) "pg_trigger_tgconstraint_index" btree (tgconstraint)
文档: pg_trigger
pg_trigger (PostgreSQL 9.0)
Table "pg_catalog.pg_trigger" Column | Type | Modifiers ----------------+------------+----------- tgrelid | oid | not null tgname | name | not null tgfoid | oid | not null tgtype | smallint | not null tgenabled | "char" | not null tgisinternal | boolean | not null tgconstrrelid | oid | not null tgconstrindid | oid | not null tgconstraint | oid | not null tgdeferrable | boolean | not null tginitdeferred | boolean | not null tgnargs | smallint | not null tgattr | int2vector | not null tgargs | bytea | tgqual | text | Indexes: "pg_trigger_oid_index" UNIQUE, btree (oid) "pg_trigger_tgrelid_tgname_index" UNIQUE, btree (tgrelid, tgname) "pg_trigger_tgconstraint_index" btree (tgconstraint)
文档: pg_trigger
pg_trigger (PostgreSQL 8.4)
Table "pg_catalog.pg_trigger" Column | Type | Modifiers ----------------+------------+----------- tgrelid | oid | not null tgname | name | not null tgfoid | oid | not null tgtype | smallint | not null tgenabled | "char" | not null tgisconstraint | boolean | not null tgconstrname | name | not null tgconstrrelid | oid | not null tgconstraint | oid | not null tgdeferrable | boolean | not null tginitdeferred | boolean | not null tgnargs | smallint | not null tgattr | int2vector | not null tgargs | bytea | Indexes: "pg_trigger_oid_index" UNIQUE, btree (oid) "pg_trigger_tgrelid_tgname_index" UNIQUE, btree (tgrelid, tgname) "pg_trigger_tgconstrname_index" btree (tgconstrname)
文档: pg_trigger
pg_trigger (PostgreSQL 8.3)
Table "pg_catalog.pg_trigger" Column | Type | Modifiers ----------------+------------+----------- tgrelid | oid | not null tgname | name | not null tgfoid | oid | not null tgtype | smallint | not null tgenabled | "char" | not null tgisconstraint | boolean | not null tgconstrname | name | not null tgconstrrelid | oid | not null tgconstraint | oid | not null tgdeferrable | boolean | not null tginitdeferred | boolean | not null tgnargs | smallint | not null tgattr | int2vector | not null tgargs | bytea | Indexes: "pg_trigger_oid_index" UNIQUE, btree (oid) "pg_trigger_tgrelid_tgname_index" UNIQUE, btree (tgrelid, tgname) "pg_trigger_tgconstrname_index" btree (tgconstrname)
文档: pg_trigger
pg_trigger (PostgreSQL 8.2)
Table "pg_catalog.pg_trigger" Column | Type | Modifiers ----------------+------------+----------- tgrelid | oid | not null tgname | name | not null tgfoid | oid | not null tgtype | smallint | not null tgenabled | boolean | not null tgisconstraint | boolean | not null tgconstrname | name | not null tgconstrrelid | oid | not null tgdeferrable | boolean | not null tginitdeferred | boolean | not null tgnargs | smallint | not null tgattr | int2vector | not null tgargs | bytea | Indexes: "pg_trigger_oid_index" UNIQUE, btree (oid) "pg_trigger_tgrelid_tgname_index" UNIQUE, btree (tgrelid, tgname) "pg_trigger_tgconstrname_index" btree (tgconstrname) "pg_trigger_tgconstrrelid_index" btree (tgconstrrelid)
文档: pg_trigger
更改历史记录
- PostgreSQL 13
- 添加列
tgparentid
(提交 b9b408c4)
- 添加列
- PostgreSQL 10
- 添加列
tgoldtable
和tgnewtable
(提交 8c48375e)
- 添加列
- PostgreSQL 9.5
- 将列
tgargs
设置为NOT NULL
(提交 82a532b3)
- 将列
- PostgreSQL 9.1
- 列
tgqual
的类型从TEXT
更改为pg_node_tree
(提交 303696c3)
- 列
- PostgreSQL 9.0
- PostgreSQL 8.3
- PostgreSQL 7.3
- 列
tgname
在同一表的触发器中必须唯一 (提交未知)
- 列
- PostgreSQL 6.2
- 添加 (提交 2d7b93c0)
参考文献
- PostgreSQL 文档: pg_trigger