Received: from fw.mccons.net (adsl-65-64-105-41.dsl.kscymo.swbell.net [65.64.105.41]) by postgresql.org (8.11.3/8.11.4) with ESMTP id g0UI0Gl14298 for ; Wed, 30 Jan 2002 13:00:16 -0500 (EST) (envelope-from bmccane@mccons.net) Received: (from root@localhost) by fw.mccons.net (8.11.3/8.11.4) id g0UI0Gp86126 for pgsql-admin@postgresql.org; Wed, 30 Jan 2002 12:00:16 -0600 (CST) (envelope-from bmccane@mccons.net) Received: from localhost (localhost [127.0.0.1]) by fw.mccons.net (8.11.3/8.11.4av) with ESMTP id g0UI0Df86079 for ; Wed, 30 Jan 2002 12:00:13 -0600 (CST) (envelope-from bmccane@mccons.net) Date: Wed, 30 Jan 2002 12:00:13 -0600 (CST) From: Brian McCane To: Subject: Re: Listing Triggers In-Reply-To: Message-ID: <20020130115327.S80122-100000@fw.mccons.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS perl-11 X-Archive-Number: 200201/267 X-Sequence-Number: 3148 On Wed, 30 Jan 2002, Arguile wrote: > Brian McCane wrote: > > How can I list the triggers on a specific table? > > Just as I was typing this I noticed Tom already replied. Just incase you > want to know all triggers referencing the table in addition to those on it > (eg. foreign key constraints). > > SELECT t.oid, t.* > FROM pg_trigger t, pg_class c > WHERE where c.oid in (t.tgrelid, t.tgconstrrelid) > AND c.relname = 'foo'; > Thanks Tom and Arguile that definitely helps. Now for my more pressing, but forgotten question. Shouldn't PostgreSQL have automatically dropped that trigger when I dropped the table? I dropped and recreated a small table with a Foreign Key, and each time I do it, I get more triggers sitting out there that reference the name of the table. This is probably not a problem if it doesn't reference the correct oid, but I am not sure. The other problem I had was that I didn't name the constraints that I created, so I had to delete them from 'pg_trigger' manually, then I had to update the trigger count in 'pg_class' manually. Would it have worked if I had changed the name from '' to 'killme' using an update to 'pg_trigger', and then said, "DROP TRIGGER killme ON foo'? - brian Wm. Brian McCane | Life is full of doors that won't open Search http://recall.maxbaud.net/ | when you knock, equally spaced amid those Usenet http://freenews.maxbaud.net/ | that open when you don't want them to. Auction http://www.sellit-here.com/ | - Roger Zelazny "Blood of Amber"