Re: showing rules/triggers with psql

From: "Richard Huxton" <dev(at)archonet(dot)com>
To: "Metzidis, Anthony" <Metzidis(at)mednet(dot)ucla(dot)edu>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: showing rules/triggers with psql
Date: 2001-03-02 11:38:23
Message-ID: 006f01c0a30d$4c470900$1001a8c0@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

From: "Metzidis, Anthony" <Metzidis(at)mednet(dot)ucla(dot)edu>

> 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mitch Vincent 2001-03-02 13:56:55 Re: platforms
Previous Message Peter Vazsonyi 2001-03-02 09:32:08 Triggered data change violation