Christopher Browne cbbrowne
Thu Feb 9 08:58:25 PST 2006
Peter Davie <Peter.Davie at relevance.com.au> writes:
> I have tried using store trigger to maintain an application trigger.  
> Can someone provide an example of how to use store trigger?

The thing about it is that the trigger needs to already be present.

We have a cache-invalidation trigger that we, on some systems, use
STORE TRIGGER on.

So, suppose the table definition is...

create table object_table (
  id serial,
  obj_name text,
  primary key(id)
);

CREATE TRIGGER cache_invalidation_my_object
    AFTER DELETE OR UPDATE ON object_table
    FOR EACH ROW
    EXECUTE PROCEDURE invalidate_cache_fun();

(With some suitable invalidate_cache_fun() function...)

- You set up this schema on all the nodes, initially.

- When subscriber nodes subscribe to a set containing object_table,
  the trigger gets shut off on the subscribers.

- You reactivate it via slonik...

  store trigger (table id=15, trigger name = 'cache_invalidation_my_object');

If the trigger wasn't already there, you could push it through via a
DDL script; that would put it on all of the nodes, and shut it off on
all but the origin.  ("store trigger" would then add it back on the
subscribers...)
-- 
output = ("cbbrowne" "@" "ca.afilias.info")
<http://dba2.int.libertyrms.com/>
Christopher Browne
(416) 673-4124 (land)



More information about the Slony1-general mailing list