Andrew Sullivan ajs
Tue Nov 29 22:50:40 PST 2005
On Tue, Nov 29, 2005 at 05:46:25PM -0500, Sven Willenberger wrote:
> So yes, I did create the trigger on the replicated CustomerTable after
> it had been created and replication started. But as a) this is an after
> insert trigger that does not affect the table at all and b) the
> resulting table that the trigger creates is not needed on the origin
> node I did not think this would hurt anything.

Well, (b) is false.  Under some circumstances, you can get away with
it, but Stuff Breaks later in sometimes surprising ways.  In
particular, if you _later_ do DDL via EXECUTE SCRIPT, things will
break in a real mess on the replica.  The underlying functions have
actually been documented by Chris in the admin guide; you can get
away with what you're doing by tricky use of them.  But you really
want to test things out; because if you have to failover, something
is guaranteed to break here.

> If I use Execute script, would this not create the same trigger on the
> origin and subscriber nodes? As I am running a partial replication
> scheme where origin and subscriber actually maintain on a small subset
> of common tables, this would work with my plan.

You want the STORE TRIGGER function.  The right way to do this is to
make a trigger that knows what node it is on, and either does work or
exists immediately depending on where it is.  

A
-- 
Andrew Sullivan  | ajs at crankycanuck.ca
I remember when computers were frustrating because they *did* exactly what 
you told them to.  That actually seems sort of quaint now.
		--J.D. Baldwin


More information about the Slony1-general mailing list