Re: select from pg_trigger - Mailing list pgsql-novice

From Jim C. Nasby
Subject Re: select from pg_trigger
Date
Msg-id 20060809225327.GE27928@pervasive.com
Whole thread Raw
In response to select from pg_trigger  ("Garcia, Joshua" <Joshua.Garcia@xerox.com>)
List 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@pervasive.com
Pervasive Software      http://pervasive.com    work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf       cell: 512-569-9461

pgsql-novice by date:

Previous
From: "Jim C. Nasby"
Date:
Subject: Re: query help
Next
From: Keith Worthington
Date:
Subject: Re: query help