By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,064 Members | 1,449 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,064 IT Pros & Developers. It's quick & easy.

About how to query trigger enabled status

P: 51
Is that possible to show all triggers enabled status(true/false) within a schema by an SQL query?
Nov 5 '10 #1
Share this Question
Share on Google+
3 Replies


Expert 100+
P: 700
Query the pg_trigger table and look into tgenabled column.
See here
http://www.postgresql.org/docs/9.0/s...g-trigger.html


To look for a trigger defined on the specific schema you should join pg_trigger with pg_class (join on tgrelid=relfilenode) and with pg_tables (join on relname=tablename) and check the value of schemaname.

Expand|Select|Wrap|Line Numbers
  1. select pg_trigger.* from pg_trigger,pg_class,pg_tables where
  2. tgrelid=relfilenode and relname=tablename and tableschema=<THE SCHEMA NAME>
  3.  
Nov 5 '10 #2

P: 51
Thanks a lot, rski!
Nov 8 '10 #3

P: 51
it's "schemaname" rather than "tableschema".
Nov 8 '10 #4

Post your reply

Sign in to post your reply or Sign up for a free account.