ddlscript_complete( integer, text, integer )

1.38. ddlscript_complete( integer, text, integer )

Function Properties

Language: PLPGSQL

Return Type: integer

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.

declare
	p_set_id			alias for $1;
	p_script			alias for $2;
	p_only_on_node		alias for $3;
	v_set_origin		int4;
begin
	perform updateRelname(p_set_id, p_only_on_node);
	if p_only_on_node = -1 then
		perform alterTableForReplication(tab_id) from sl_table where tab_set in (select set_id from sl_set where set_origin = getLocalNodeId('_schemadoc'));

		return  createEvent('_schemadoc', 'DDL_SCRIPT', 
			p_set_id::text, p_script::text, p_only_on_node::text);
	else
		perform alterTableForReplication(tab_id) from sl_table;
	end if;
	return NULL;
end;