droppath( integer, integer )

1.53. droppath( integer, integer )

Function Properties

Language: PLPGSQL

Return Type: bigint

Generate DROP_PATH event to drop path from pa_server to pa_client

	p_pa_server		alias for $1;
	p_pa_client		alias for $2;
	v_row			record;
	-- ----
	-- Grab the central configuration lock
	-- ----
	lock table sl_config_lock;

	-- ----
	-- There should be no existing subscriptions. Auto unsubscribing
	-- is considered too dangerous. 
	-- ----
	for v_row in select sub_set, sub_provider, sub_receiver
			from sl_subscribe
			where sub_provider = p_pa_server
			and sub_receiver = p_pa_client
		raise exception 
			'Slony-I: Path cannot be dropped, subscription of set % needs it',
	end loop;

	-- ----
	-- Drop all sl_listen entries that depend on this path
	-- ----
	for v_row in select li_origin, li_provider, li_receiver
			from sl_listen
			where li_provider = p_pa_server
			and li_receiver = p_pa_client
		perform dropListen(
				v_row.li_origin, v_row.li_provider, v_row.li_receiver);
	end loop;

	-- ----
	-- Now drop the path and create the event
	-- ----
	perform dropPath_int(p_pa_server, p_pa_client);

	-- Rewrite sl_listen table
	perform RebuildListenEntries();

	return  createEvent ('_schemadoc', 'DROP_PATH',
			p_pa_server::text, p_pa_client::text);