Matthew Rich mrich
Fri May 13 21:22:52 PDT 2005
I'm glad that someone else is looking at this as well.  Here is a
revised patch that updates the constraint table as well, so that
pg_depend is updated in turn.  I'm still seeing some strange results on
the slave, I see trigger dependencies that still reference the table
relation, but I don't see that error anymore.  I'm still looking into
that.
The only real solution that I can think of, that isn't dodgy (dependent
on specific catalog schemas etc. etc.), would be to actually drop the
triggers and constraints and regenerate them from data stored in the
slony schema, those are significant changes though.

Matt

On Fri, 2005-05-13 at 16:01 -0400, Aaron Thul wrote:
> I no sooner have the same problem and it seems people are talking about it.  How 
> serendipitous for me. 
> 
> I have the exact same scenario and I too have the problem of the trigger. 
> "ERROR:  could not find trigger 40749"  Matt, I am going to give your patch a 
> try give it some extra testing.  I will let you know if it solves the problem 
> for my situation.  If it does then what you did might be pretty sane.  
> 
> Aaron Thul
> 
> 
> mrich at tigris.org wrote:
> >
> >> ... so I've been playing with alterTableForReplication/alterTableRestore
> >> () and it does seem to bear out that when removing the code that
> >> disables triggers, the scripts seem to execute fine on the slave.  There
> >> seem to be a couple of methods to disable triggers, which is the
> >> "correct" method I don't know:
> >
> >Since the dependencies table (pg_depend) is the only place that I could
> >actually find any reference to the relations in questions, I decided to
> >muck around with it a bit.  Following the existing methodology, I
> >rewrote all the constraint/trigger dependencies for subscribed tables to
> >also point to the pk index.  This appears to actually avoid the "missing
> >trigger" problem, and the scripts seem to execute correctly.  I don't
> >exactly know how sane this is, and I didn't actually test it that much,
> >but there it is.  I thought I would throw it out there nonetheless.
> >
> >Matt
> >
> >-- 
> >Matthew Rich <mrich at tigris.org>
> >
> >--- slony1_funcs.sql.orig	2005-05-10 23:20:32.000000000 -0700
> >+++ slony1_funcs.sql	2005-05-11 18:49:07.000000000 -0700
> >@@ -3264,7 +3264,8 @@
> > 					set reltriggers = reltriggers - v_n
> > 					where oid = v_tab_row.tab_reloid;
> > 		end if;
> >-
> >+		update "pg_catalog".pg_depend set refobjid = v_tab_row.indexrelid where refobjid = v_tab_row.tab_reloid and objid in (select oid from "pg_catalog".pg_trigger where tgrelid = v_tab_row.indexrelid);
> >+		update "pg_catalog".pg_depend set refobjid = v_tab_row.indexrelid where refobjid = v_tab_row.tab_reloid and objid in (select oid from "pg_catalog".pg_constraint where conrelid = v_tab_row.indexrelid);
> > 		-- ----
> > 		-- Disable all existing rules
> > 		-- ----
> >@@ -3367,6 +3368,9 @@
> > 		-- ----
> > 		execute ''drop trigger "_ at CLUSTERNAME@_denyaccess_'' || 
> > 				p_tab_id || ''" on '' || v_tab_fqname;
> >+
> >+		update "pg_catalog".pg_depend set refobjid = v_tab_row.tab_reloid where refobjid = v_tab_row.indexrelid and objid in (select oid from "pg_catalog".pg_trigger where tgrelid = v_tab_row.indexrelid);
> >+		update "pg_catalog".pg_depend set refobjid = v_tab_row.tab_reloid where refobjid = v_tab_row.indexrelid and objid in (select oid from "pg_catalog".pg_constraint where conrelid = v_tab_row.indexrelid);
> > 				
> > 		-- ----
> > 		-- Restore all original triggers_______________________________________________
> >Slony1-general mailing list
> >Slony1-general at gborg.postgresql.org
> >http://gborg.postgresql.org/mailman/listinfo/slony1-general
> >
> 
> _______________________________________________________
> Sent through e-mol. E-mail, Anywhere, Anytime. http://www.e-mol.com
> 
> 
> 
> _______________________________________________
> Slony1-general mailing list
> Slony1-general at gborg.postgresql.org
> http://gborg.postgresql.org/mailman/listinfo/slony1-general
> 

-- 
Matthew Rich <mrich at tigris.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: slony-1.0.5-deferred-triggers-2.patch
Type: text/x-patch
Size: 1747 bytes
Desc: not available
Url : http://gborg.postgresql.org/pipermail/slony1-general/attachments/20050513/7c9f1606/slony-1.0.5-deferred-triggers-2-0001.bin


More information about the Slony1-general mailing list