SLONIK STORE TRIGGER

SLONIK STORE TRIGGER

Name

STORE TRIGGER --  Indicate that a trigger should not be disabled by Slony-I on a subscriber node

Synopsis

STORE TRIGGER (options);

Description

By default, all user defined triggers and constraints are disabled on all subscriber nodes while a table is replicated. This command can be used to explicitly exclude a trigger from being disabled.

TABLE ID = ival

The unique, numeric ID number of the table the trigger is defined for.

TRIGGER NAME = 'string'

The name of the trigger as it appears in the pg_trigger system catalog.

EVENT NODE = ival

(Optional) The ID of the node used to create the configuration event that tells all existing nodes about the special trigger. Default value is 1.

Note: A nifty trick is that you can run STORE TRIGGER before the trigger is installed; that will not cause any errors. You could thus add Slony-I's handling of the trigger before it is installed. That allows you to be certain that it becomes active on all nodes immediately upon its installation via SLONIK EXECUTE SCRIPT; there is no risk of events getting through in between the EXECUTE SCRIPT and STORE TRIGGER events.

This uses schemadocstoretrigger( integer, name ).

Example

STORE TRIGGER (
    TABLE ID = 2,
    TRIGGER NAME = 'cache_invalidation'
);
    

Locking Behaviour

This operation will need to acquire an exclusive lock on the specified table on each node to which it applies in order to alter table schemas to add back the trigger, but (hopefully!) only briefly.

Version Information

This command was introduced in Slony-I 1.0

In Slony-I version 2.0, this command is removed as obsolete because triggers are no longer "messed around with" in the system catalogue.