Home > Archive > Slony1 PostgreSQL Replication > February 2006 > Usage example for store trigger









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Usage example for store trigger
Peter Davie

2006-02-09, 7:24 am

I have tried using store trigger to maintain an application trigger.
Can someone provide an example of how to use store trigger?

Thanks
Peter
Christopher Browne

2006-02-09, 11:24 am

Peter Davie <Peter.Davie- KlsGNL9SCbcJY7gZg3T8
ig@public.gmane.org> 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_m
y_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)
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com