X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C94EF9DCAA3 for ; Thu, 9 Mar 2006 10:25:33 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 76023-01 for ; Thu, 9 Mar 2006 10:25:37 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from server114.midphase.com (server114.midphase.com [66.225.255.59]) by postgresql.org (Postfix) with ESMTP id 599979DCB8E for ; Thu, 9 Mar 2006 10:25:31 -0400 (AST) Received: from [200.161.74.107] (helo=Pragya01) by server114.midphase.com with smtp (Exim 4.52) id 1FHM5U-0008Ek-Re; Thu, 09 Mar 2006 08:25:57 -0600 From: =?iso-8859-1?Q?Fl=E1vio_Suguimoto?= To: "Richard Huxton" Cc: Subject: Re: Problems with disabling triggers in Postgres 7.3.9 Date: Thu, 9 Mar 2006 11:25:28 -0300 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Importance: Normal In-Reply-To: <44103409.6030801@archonet.com> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - server114.midphase.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - pragyatechnologies.com X-Source: X-Source-Args: X-Source-Dir: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.08 required=5 tests=[AWL=0.080] X-Spam-Score: 0.08 X-Spam-Level: X-Archive-Number: 200603/139 X-Sequence-Number: 24485 Hi Richard, I have that trigger running on AFTER INSERT of participation table. That trigger inserts 3 new record for each line i inserted in participation. I guess the problem is in these two statement: EXECUTE ''update pg_class set reltriggers=0 where relname = '' || quote_literal(tablename); EXECUTE ''update pg_class set reltriggers = count(*) from pg_trigger where pg_class.oid=tgrelid and relname = '' || quote_literal(tablename); These statement is a walk-around to disable and enable the trigger on a table and i use this to avoid the trigger be called recursively. My question is there is another to do this trigger avoiding need to disable/enable the triggers? Or there is an way to solve this problem with RelationBuildTriggers? regards, Flávio Suguimoto -----Original Message----- From: Richard Huxton [mailto:dev@archonet.com] Sent: Thursday, March 09, 2006 10:56 AM To: Flávio Suguimoto Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] Problems with disabling triggers in Postgres 7.3.9 Flávio Suguimoto wrote: > Hi all, > > I have a problem in a trigger that disable all the triggers of a table. This > error occurs randomly and my guess is that occurs when i have a lot of > concurrents inserts in the table participation. > > The error is : RelationBuildTriggers: 2 record(s) not found for rel > participation Well, at the very least you should get an exclusive write-lock on the table "participation" before turning its triggers off. However, I'm doubtful that you really want to do that in any case. Can I ask what problem you are trying to solve? Oh, and upgrade to 7.3.14 too - you're missing 5 sets of bug-fixes. -- Richard Huxton Archonet Ltd