Slony-I 1.2.23 Documentation | ||||
---|---|---|---|---|
Prev | Fast Backward | Chapter 1. Schema schemadoc | Fast Forward | Next |
1.123. storetrigger_int( integer, name )
Function Properties
Language: PLPGSQL
Return Type: integer
storeTrigger_int (trig_tabid, trig_tgname) Processes STORE_TRIGGER event to make sure that trigger trig_tgname on replicated table trig_tabid is NOT disabled.declare p_trig_tabid alias for $1; p_trig_tgname alias for $2; v_tab_altered boolean; begin -- ---- -- Grab the central configuration lock -- ---- lock table sl_config_lock; -- ---- -- Get the current table status (altered or not) -- ---- select tab_altered into v_tab_altered from sl_table where tab_id = p_trig_tabid; if not found then -- ---- -- Not found is no hard error here, because that might -- mean that we are not subscribed to that set -- ---- return 0; end if; -- ---- -- If the table is modified for replication, restore the original state -- ---- if v_tab_altered then perform alterTableRestore(p_trig_tabid); end if; -- ---- -- Make sure that an entry for this trigger exists -- ---- delete from sl_trigger where trig_tabid = p_trig_tabid and trig_tgname = p_trig_tgname; insert into sl_trigger ( trig_tabid, trig_tgname ) values ( p_trig_tabid, p_trig_tgname ); -- ---- -- Put the table back into replicated state if it was -- ---- if v_tab_altered then perform alterTableForReplication(p_trig_tabid); end if; return p_trig_tabid; end;