dropset_int(p_set_id integer)

8.63. dropset_int(p_set_id integer)

Function Properties

Language: PLPGSQL

Return Type: integer

declare
	v_tab_row			record;
begin
	-- ----
	-- 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;