Slony-I 2.2.10 Documentation
Prev | Fast Backward | Chapter 8. Schema schemadoc | Fast Forward | Next

# 8.98. setaddsequence(p_seq_comment integer, p_fqname integer, p_seq_id text, p_set_id text)

Function Properties

Language: PLPGSQL

Return Type: bigint

setAddSequence (set_id, seq_id, seq_fqname, seq_comment) On the origin node for set set_id, add sequence seq_fqname to the replication set, and raise SET_ADD_SEQUENCE to cause this to replicate to subscriber nodes.

    declare
    	v_set_origin		int4;
    begin
    	-- ----
    	-- Grab the central configuration lock
    	-- ----
    	lock table sl_config_lock;

    	-- ----
    	-- 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: setAddSequence(): set % not found', p_set_id;
    	end if;
    	if v_set_origin != getLocalNodeId('_schemadoc') then
    		raise exception 'Slony-I: setAddSequence(): set % has remote origin - submit to origin node', 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 sequence to currently subscribed set %',
    				p_set_id;
    	end if;

    	-- ----
    	-- Add the sequence to the set and generate the SET_ADD_SEQUENCE event
    	-- ----
    	perform setAddSequence_int(p_set_id, p_seq_id, p_fqname,
    			p_seq_comment);
    	return  createEvent('_schemadoc', 'SET_ADD_SEQUENCE',
    						p_set_id::text, p_seq_id::text,
    						p_fqname::text, p_seq_comment::text);
    end;

Prev | Home | Next
sequencesetvalue(p_ignore_missing integer, p_last_value integer, p_ev_seqno bigint, p_seq_origin bigint, p_seq_id boolean) | Up | setaddsequence_int(p_seq_comment integer, p_fqname integer, p_seq_id text, p_set_id text)