mergeset_int(integer, integer)

6.79. mergeset_int(integer, integer)

Function Properties

Language: PLPGSQL

Return Type: integer

mergeSet_int(set_id, add_id) - Perform MERGE_SET event, merging all objects from set add_id into set set_id.

declare
	p_set_id			alias for $1;
	p_add_id			alias for $2;
begin
	-- ----
	-- Grab the central configuration lock
	-- ----
	lock table sl_config_lock;
	
	update sl_sequence
			set seq_set = p_set_id
			where seq_set = p_add_id;
	update sl_table
			set tab_set = p_set_id
			where tab_set = p_add_id;
	delete from sl_subscribe
			where sub_set = p_add_id;
	delete from sl_setsync
			where ssy_setid = p_add_id;
	delete from sl_set
			where set_id = p_add_id;

	return p_set_id;
end;