dropset_int(integer)

6.58. dropset_int(integer)

Function Properties

Language: PLPGSQL

Return Type: integer

declare
	p_set_id			alias for $1;
	v_tab_row			record;
begin
	-- ----
	-- Grab the central configuration lock
	-- ----
	lock table sl_config_lock;
	
	-- ----
	-- Restore all tables original triggers and rules and remove
	-- our replication stuff.
	-- ----
	for v_tab_row in select tab_id from sl_table
			where tab_set = p_set_id
			order by tab_id
	loop
		perform alterTableDropTriggers(v_tab_row.tab_id);
	end loop;

	-- ----
	-- Remove all traces of the set configuration
	-- ----
	delete from sl_sequence
			where seq_set = p_set_id;
	delete from sl_table
			where tab_set = p_set_id;
	delete from sl_subscribe
			where sub_set = p_set_id;
	delete from sl_setsync
			where ssy_setid = p_set_id;
	delete from sl_set
			where set_id = p_set_id;

	-- Regenerate sl_listen since we revised the subscriptions
	perform RebuildListenEntries();

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

	return p_set_id;
end;