From: "Metzidis, Anthony" <[EMAIL PROTECTED]>
> hey,
> kind of a simple question. How can you show the rules/triggers on a
database
> using psql. Even better: how can you show all
rules/triggers/constrains/etc
> that pertain to a given table?
>
> as always...thanks.
>
> --tony
The 7.1 docs have some useful info on system tables, but here's something
from my notes. The RI_Constraint... triggers are automatically generated.
You might want to make this into a view if you use it frequently.
richardh=> select cl.relname,tr.tgname as triggername, tr.tgenabled,
fn.proname as func_name from pg_trigger as tr, pg_class as cl,
pg_proc as fn where tr.tgrelid=cl.oid and tr.tgfoid=fn.oid and cl.relname ~
'^';
relname | triggername | tgenabled | func_name
-----------+-----------------------------+-----------+----------------------
pg_shadow | pg_sync_pg_pwd | t | update_pg_pwd
company | RI_ConstraintTrigger_121307 | t | RI_FKey_check_ins
e_country | RI_ConstraintTrigger_121309 | t | RI_FKey_noaction_del
e_country | RI_ConstraintTrigger_121311 | t | RI_FKey_noaction_upd
person | RI_ConstraintTrigger_121389 | t | RI_FKey_check_ins
company | RI_ConstraintTrigger_121391 | t | RI_FKey_noaction_del
company | RI_ConstraintTrigger_121393 | t | RI_FKey_noaction_upd
foo | foo_c_lctrig | t | foo_c_lcupdate
(8 rows)
- Richard Huxton