Обсуждение: select from pg_trigger
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.
Thanks in advance,
Josh
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