X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id C188E30EED4 for ; Tue, 17 Jun 2003 18:47:55 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 72568-03 for ; Tue, 17 Jun 2003 15:47:45 -0300 (ADT) Received: from trade-india.com (ns1.trade-india.com [66.234.10.14]) by svr1.postgresql.org (Postfix) with SMTP id E5F5C30ECBB for ; Tue, 17 Jun 2003 15:47:44 -0300 (ADT) Received: (qmail 27317 invoked by uid 505); 17 Jun 2003 18:47:47 -0000 Received: from mallah@trade-india.com by ns1.trade-india.com by uid 502 with qmail-scanner-1.16 (clamscan: 0.54. spamassassin: 2.54. Clear:SA:0(-100.1/5.0):. Processed in 0.555766 secs); 17 Jun 2003 18:47:47 -0000 Received: from ns1.trade-india.com (HELO trade-india.com) (66.234.10.14) by ns1.trade-india.com with SMTP; 17 Jun 2003 18:47:46 -0000 Received: from 219.65.230.103 (SquirrelMail authenticated user mallah) by mail.trade-india.com with HTTP; Wed, 18 Jun 2003 00:17:46 +0530 (IST) Message-ID: <1182.219.65.230.103.1055875666.squirrel@mail.trade-india.com> Date: Wed, 18 Jun 2003 00:17:46 +0530 (IST) Subject: Re: disabling triggers From: To: In-Reply-To: <200306171131.24578.josh@agliodbs.com> References: <1164.219.65.230.103.1055871254.squirrel@mail.trade-india.com> <200306171058.44814.josh@agliodbs.com> <1175.219.65.230.103.1055873842.squirrel@mail.trade-india.com> <200306171131.24578.josh@agliodbs.com> X-Priority: 3 Importance: Normal X-MSMail-Priority: Normal Cc: X-Mailer: SquirrelMail (version 1.2.6) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Archive-Number: 200306/200 X-Sequence-Number: 13958 > Mallah, > >> >> Is setting reltriggers=0 on pg_class an accepatble way of >> >> disabling triggers on a table temporarily? >> >> Ok , but someone on list was scary few months back. > > I've done it many times without a problem. The trick is re-setting the triggers to the > correct number when you're done. See the scripts that pg_dump -a creates for a good example. > >> Agreed , but there is no easy way to view current trigger defination of existing triggers >> before dropping from psql . > > So? Create a perl script. It can: > 1) query the system tables to find out the trigger definintion > (you'll need pg_trigger, pg_proc, and pg_type) > 2) generate a script to restore all the triggers to be used later; 3) drop all the triggers > > Of course, setting reltriggers=0 is probably a lot easier. in past we tried creating a plpgsql function that takes relname and schema and try setting reltriggers=0 on disabling and = (select count(*) from pg_trigger for that relname and schema) on enabling . we got stuck somewhere and abandoned it , do u think above approach would work in principle ? i will retry it tommorw though and post the results. regds mallah. > > -- > -Josh Berkus > Aglio Database Solutions > San Francisco > > > ---------------------------(end of broadcast)--------------------------- TIP 3: if > posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your message can get through > to the mailing list cleanly ----------------------------------------- Get your free web based email at trade-india.com. "India's Leading B2B eMarketplace.!" http://www.trade-india.com/