reshapesubscription(integer, integer, integer)

6.94. reshapesubscription(integer, integer, integer)

Function Properties

Language: PLPGSQL

Return Type: integer

Run on a receiver/subscriber node when the provider for that subscription is being changed. Slonik will invoke this method before the SUBSCRIBE_SET event propogates to the receiver so listen paths can be updated.

declare
	p_sub_set			alias for $1;
	p_sub_provider		alias for $2;
	p_sub_receiver		alias for $3;
begin
	-- ----
	-- Grab the central configuration lock
	-- ----
	lock table sl_config_lock;

	update sl_subscribe set sub_provider=p_sub_provider
		   WHERE sub_set=p_sub_set AND sub_receiver=p_sub_receiver;
	if found then
	   perform RebuildListenEntries();
	   notify "_schemadoc_Restart";
	end if;
	return 0;
end