且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何获取与PostgreSQL中的视图或表相关联的触发器

更新时间:2022-11-04 22:38:27

information_schema.triggers (除了慢)是每个文档


视图触发器包含在当前用户拥有的表和视图上的当前
数据库中定义的所有触发器,或者具有除 SELECT 之外的一些
特权。

The view triggers contains all triggers defined in the current database on tables and views that the current user owns or has some privilege other than SELECT on.

这意味着你只能看到具有适当权限的触发器。

Meaning, you only get to see triggers you have appropriate privileges on.

所有触发器,请查看系统目录 pg_trigger

To see all triggers for a table, look in the system catalog pg_trigger

SELECT tgname
FROM   pg_trigger
WHERE  tgrelid = 'myschema.mytbl'::regclass; -- optionally schema-qualified

适用于表视图。 >
或者您可以使用GUI来显示对象浏览器中表节点下的列表pgAdmin。

Works for tables and views.
Or you could use a GUI like pgAdmin that displays the list under the table node in the object browser.