unsubscribeset_int(p_sub_receiver integer, p_sub_set integer)

8.135. unsubscribeset_int(p_sub_receiver integer, p_sub_set integer)

Function Properties

Language: PLPGSQL

Return Type: integer

unsubscribeSet_int (sub_set, sub_receiver) All the REAL work of removing the subscriber is done before the event is generated, so this function just has to drop the references to the subscription in sl_subscribe.

	-- ----
	-- Grab the central configuration lock
	-- ----
	lock table sl_config_lock;

	-- ----
	-- All the real work is done before event generation on the
	-- subscriber.
	-- ----

	--if this event unsubscribes the provider of this node
	--then this node should unsubscribe itself from the set as well.
	if exists (select true from 
		   sl_subscribe where 
		   sub_set=p_sub_set and sub_provider=p_sub_receiver
		   and sub_receiver=getLocalNodeId('_schemadoc'))
	   perform unsubscribeSet(p_sub_set,getLocalNodeId('_schemadoc'),true);
	end if;

	delete from sl_subscribe
			where sub_set = p_sub_set
				and sub_receiver = p_sub_receiver;

	-- Rewrite sl_listen table
	perform RebuildListenEntries();

	return p_sub_set;