storeset_int(p_set_comment integer, p_set_origin integer, p_set_id text)

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

# 8.125. storeset_int(p_set_comment integer, p_set_origin integer, p_set_id text)

Function Properties

Language: PLPGSQL

Return Type: integer

storeSet_int (set_id, set_origin, set_comment) Process the STORE_SET event, indicating the new set with given ID, origin node, and human readable comment.

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

    	select 1 into v_dummy
    			from sl_set
    			where set_id = p_set_id
    			for update;
    	if found then
    		update sl_set
    				set set_comment = p_set_comment
    				where set_id = p_set_id;
    	else
    		if not exists (select 1 from sl_node
    						where no_id = p_set_origin) then
    			perform storeNode_int (p_set_origin, '<event pending>');
    		end if;
    		insert into sl_set
    				(set_id, set_origin, set_comment) values
    				(p_set_id, p_set_origin, p_set_comment);
    	end if;

    	-- Run addPartialLogIndices() to try to add indices to unused sl_log_? table
    	perform addPartialLogIndices();

    	return p_set_id;
    end;

Prev | Home | Next
storeset(p_set_comment integer, p_set_id text) | Up | string_agg(text)