ddlscript_complete(integer, text, integer)

6.41. ddlscript_complete(integer, text, integer)

Function Properties

Language: PLPGSQL

Return Type: bigint

ddlScript_complete(set_id, script, only_on_node) After script has run on origin, this fixes up relnames, restores triggers, and generates a DDL_SCRIPT event to request it to be run on replicated slaves.

	p_set_id			alias for $1;
	p_script			alias for $2;
	p_only_on_node		alias for $3;
	v_set_origin		int4;
	v_query				text;
	v_row				record;
	if p_only_on_node = -1 then
	        perform ddlScript_complete_int(p_set_id,p_only_on_node);
		return  createEvent('_schemadoc', 'DDL_SCRIPT', 
			p_set_id::text, p_script::text, p_only_on_node::text);
	end if;
	if p_only_on_node <> -1 then
		for v_row in execute
			'select setting from _slony1_saved_session_replication_role' loop
			v_query := 'set session_replication_role to ' || v_row.setting;
		end loop;
		execute v_query;
		execute 'drop table _slony1_saved_session_replication_role';
		perform ddlScript_complete_int(p_set_id,p_only_on_node);
	end if;
	return NULL;