Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 85EC0B5DBD6 for ; Fri, 17 Jun 2011 15:48:13 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 67591-10 for ; Fri, 17 Jun 2011 18:48:06 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pz0-f46.google.com (mail-pz0-f46.google.com [209.85.210.46]) by mail.postgresql.org (Postfix) with ESMTP id 5D307B5D803 for ; Fri, 17 Jun 2011 15:48:06 -0300 (ADT) Received: by pzk9 with SMTP id 9so2001347pzk.19 for ; Fri, 17 Jun 2011 11:48:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=WwBImJmhIgTsWBt29FTYzH6GYosIwoS4lI4NLEK2V0E=; b=oGx9CXH/aQarA00WHd/fEDGnOADJs5Zzu8EFnMEKg2LabEQuWN7nyax3drx27/HMOZ uPmJlLCvvkSKC6QNVY7VjvQe8x6s8S8I68vtmMv+Lx+2rMJZZv0RukX7RfYT+UVB+1Zu 5nRsXygedoFOTlOld8R0dmOkR701JyUFNfBfU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=CsL2dR7OkhGTUV2isoVaVO9Ri/myFfSqUdHkDn20XIdCcK+07J/CwJkLeqqLudkAiy YKpOTR0LxcGrwVY6vMa2VPc1COfwsTM/os14r/v93WTn4VryO31lB5wUQOXoPLZvA8t7 5dwsbZValKpjbMwR6GWKVckyJcVhTlPrREXsc= MIME-Version: 1.0 Received: by 10.68.17.194 with SMTP id q2mr370586pbd.44.1308336485557; Fri, 17 Jun 2011 11:48:05 -0700 (PDT) Received: by 10.68.41.97 with HTTP; Fri, 17 Jun 2011 11:48:05 -0700 (PDT) In-Reply-To: <4DFACE72.3090505@planit.com.br> References: <4DF21A1B.3060101@planit.com.br> <4DFACE72.3090505@planit.com.br> Date: Fri, 17 Jun 2011 14:48:05 -0400 Message-ID: Subject: Re: Behaviour of triggers on replicated and non replicated tables From: Robert Haas To: "Luiz K. Matsumura" Cc: pgsql-bugs@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=2.421 tagged_above=-5 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, FS_REPLICA=3.599, RFC_ABUSE_POST=0.001, SARE_SPEC_REPLICA=0.72 X-Spam-Level: ** X-Archive-Number: 201106/155 X-Sequence-Number: 30534 2011/6/16 Luiz K. Matsumura : > Em 16/06/2011 16:39, Robert Haas escreveu: > > 2011/6/10 Luiz K. Matsumura : > > I need help to know if the follow scenario is a expected behaviour, a bug= of > postgres or a bug of slony: > > Postgres v8.4.8 > Slony-I v 2.0.5 > > I have table replicated with slony and that do some updates in another ta= ble > not replicated. > > The trigger on replicated table was enabled on the slave database with th= e > command: > > ALTER TABLE table1 ENABLE ALLWAYS TRIGGER trigger1; > > And this trigger is working fine as expected. > > The strange behaviour is that trigger do a update in another table not > replicated, let=B4s say table2, and > the triggers of this table is not fired. > A unexpected behaviour IMHO, if I do > > ALTER TABLE table2 ENABLE ALWAYS TRIGGER trigger2; > > Then the trigger2 is fired now when trigger1 do a update in table2. > > My doubt is: since table2 is not replicated why they triggers dont fire e= ven > by a update command in > a trigger of a replicated table ? > > I'm confused. If you enable the trigger on table2, it's going to fire > when someone updates table2. Whether or not the update is coming from > another trigger or directly from the user has nothing to do with it. > > Thanks for reply Robert. > > This is the point, when the trigger of table2 was create with a command l= ike > this > > CREATE TRIGGER trg_table2 > =A0 BEFORE INSERT OR UPDATE > =A0 ON table2 > =A0 FOR EACH ROW > =A0 EXECUTE PROCEDURE trg_table2(); > > The trigger is enabled by default as expected. If I do a update on table2 > the trigger fire normally. > But when a replicated table fire a trigger that do the same update, now t= he > trigger on table2 don=B4t fire. > I don=B4t know if this is slony disabling all triggers=A0 unless REPLICA = and > ALLWAYS trrigers even over not replicated > tables or this is managed by postgresql OK, I see. That's got something to do with what Slony does internally, which unfortunately I'm not qualified to comment on, not being a Slony guy. --=20 Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company