Slony-I 2.1.4 Documentation | ||||
---|---|---|---|---|
Prev | Fast Backward | Chapter 8. Schema schemadoc | Fast Forward | Next |
8.110. setaddtable(p_tab_comment integer, p_tab_idxname integer, p_fqname text, p_tab_id name, p_set_id text)
Function Properties
Language: PLPGSQL
Return Type: bigint
setAddTable (set_id, tab_id, tab_fqname, tab_idxname, tab_comment) Add table tab_fqname to replication set on origin node, and generate SET_ADD_TABLE event to allow this to propagate to other nodes. Note that the table id, tab_id, must be unique ACROSS ALL SETS.declare v_set_origin int4; begin -- ---- -- Check that we are the origin of the set -- ---- select set_origin into v_set_origin from sl_set where set_id = p_set_id; if not found then raise exception 'Slony-I: setAddTable(): set % not found', p_set_id; end if; if v_set_origin != getLocalNodeId('_schemadoc') then raise exception 'Slony-I: setAddTable(): set % has remote origin', p_set_id; end if; if exists (select true from sl_subscribe where sub_set = p_set_id) then raise exception 'Slony-I: cannot add table to currently subscribed set % - must attach to an unsubscribed set', p_set_id; end if; -- ---- -- Add the table to the set and generate the SET_ADD_TABLE event -- ---- perform setAddTable_int(p_set_id, p_tab_id, p_fqname, p_tab_idxname, p_tab_comment); return createEvent('_schemadoc', 'SET_ADD_TABLE', p_set_id::text, p_tab_id::text, p_fqname::text, p_tab_idxname::text, p_tab_comment::text); end;