pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@megazone23.bigpanda.com>
To: Urs Steiner <postgresql@darkstone.ch>
Cc: pgsql-sql@postgresql.org
Subject: Re: list triggers ?
Date: Tue, 22 Jan 2002 08:12:31 -0800 (PST)
Message-ID: <20020122081058.N5946-100000@megazone23.bigpanda.com> (raw)
In-Reply-To: <0dfc01c1a35c$4c78fa00$ecb88481@ethz.ch>

On Tue, 22 Jan 2002, Urs Steiner wrote:

> Hi Stephan
>
>
> >> NOTICE:  CREATE TABLE will create implicit trigger(s) for FOREIGN KEY
> >> check(s)
> >> CREATE
>
> >  select relname, tgname, tgtype, proname, prosrc, tgisconstraint,
> > tgconstrname, tgconstrrelid, tgdeferrable, tginitdeferred, tgnargs,
> > tgattr, tgargs from (pg_trigger join pg_class on tgrelid=pg_class.oid)
> > join pg_proc on (tgfoid=pg_proc.oid);
>
> ok, if fone that and i could even modify the statement (where
> relname='kunden'), so i get only the ones i want to see ...
>
>  relname |           tgname           | tgtype |       proname        |
> prosrc        | tgisconstraint |     tgconstrname      | tgconstrrelid |
> tgdeferrable | tginitdeferred | tgnargs | tgattr |
> tgargs
> ---------+----------------------------+--------+----------------------+-
> ---------------------+----------------+-----------------------+---------
> ------+--------------+----------------+---------+--------+--------------
> ---------------------------------------------------------------------
>  kunden  | RI_ConstraintTrigger_19083 |     21 | RI_FKey_check_ins    |
> RI_FKey_check_ins    | t              | kunden_abt_fk         |
> 18972 | f            | f              |       6 |        |
> kunden_abt_fk\000kunden\000kategorien\000UNSPECIFIED\000abteilung\000id\
> 000
>  kunden  | RI_ConstraintTrigger_19290 |      9 | RI_FKey_noaction_del |
> RI_FKey_noaction_del | t              | mitarbeiter_kunden_fk |
> 19268 | f            | f              |       6 |        |
> mitarbeiter_kunden_fk\000mitarbeiter\000kunden\000UNSPECIFIED\000id\000i
> d\000
> [and some more]
>
> as much as i get it, i want the first one, and i want to delete it
> (erronous construction) ...
> deleting is done with "DROP TRIGGER <trigger name> ON kunden;"
> but what is the trigger name ? tgname doesnt work, tgconstrname also not
> or am i entirely on the wrong track ?

tgname is the right thing, although you'll need to double quote the name
because it's mixed case.  However, there are also two triggers on the
target (I guess kunden_abt_fk?) that are associated with the constraint
(each fk cosntraint is three triggers).  I usually use the tgargs to
determine which triggers go together.





view thread (4+ messages)

Message-ID: <20020122081058.N5946-100000@megazone23.bigpanda.com>
Permalink:  ../20020122081058.N5946-100000@megazone23.bigpanda.com/
Also on:    postgresql.org/message-id/20020122081058.N5946-100000@megazone23.bigpanda.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: sszabo@megazone23.bigpanda.com, postgresql@darkstone.ch
  Subject: Re: list triggers ?
  In-Reply-To: <20020122081058.N5946-100000@megazone23.bigpanda.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox