如何获取与PostgreSQL中的视图或表相关联的触发器 [英] How to get the trigger(s) associated with a view or a table in PostgreSQL

查看:1146
本文介绍了如何获取与PostgreSQL中的视图或表相关联的触发器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要求,我必须得到与给定表/视图相关联的触发器列表。

任何人都可以帮助我找到PostgreSQL中的表的触发器?

I have one requirement that I have to get the list of triggers associated to the given table/view.
Can anyone help me to find the triggers for a table in PostgreSQL?

推荐答案

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.

这篇关于如何获取与PostgreSQL中的视图或表相关联的触发器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆