Re: select from pg_trigger

From: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
To: "Garcia, Joshua" <Joshua(dot)Garcia(at)xerox(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: select from pg_trigger
Date: 2006-08-09 22:53:27
Message-ID: 20060809225327.GE27928@pervasive.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Wed, Aug 09, 2006 at 10:05:33AM -0700, Garcia, Joshua wrote:
> Is there a way for me to SELECT from pg_trigger the names of all the
> functions that I've added to my database, plus the names of the tables
> they are triggered on? Ultimately, I want to create a list I can use to
> drop all triggers.

You just need to join pg_trigger to pg_class to get the trigger and
table names, then just form the DROP statements...

SELECT 'DROP TRIGGER ' || tgname || ' ON ' || relname ...

Might also want to check out newsysviews on pgfoundry; I'm pretty sure
there's a trigger view it there that does what you want.
--
Jim C. Nasby, Sr. Engineering Consultant jnasby(at)pervasive(dot)com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Keith Worthington 2006-08-09 23:28:00 Re: query help
Previous Message Jim C. Nasby 2006-08-09 22:49:34 Re: query help