Slony-I 2.1.1 Documentation
Prev | Fast Backward | Chapter 8. Schema schemadoc | Fast Forward | Next

# 8.44. ddlscript_complete(p_only_on_node integer, p_script text, p_set_id 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.

    declare
    	v_set_origin		int4;
    	v_query				text;
    	v_row				record;
    begin
    	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;
    end;

Prev | Home | Next
createevent(p_event_type name, p_cluster_name text) | Up | ddlscript_complete_int(p_only_on_node integer, p_set_id integer)