Slony-I REL_1_1_0 Documentation | ||||
---|---|---|---|---|
Prev | Fast Backward | Chapter 1. Schema schemadoc | Fast Forward | Next |
Function Properties
Language: PLPGSQL
Return Type: bigint
ddlScript(set_id, script, only_on_node) Generates a SYNC event, runs the script on the origin, and then 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 -- ---- -- Grab the central configuration lock -- ---- lock table sl_config_lock; -- ---- -- Check that the set exists and originates here -- ---- select set_origin into v_set_origin from sl_set where set_id = p_set_id for update; if not found then raise exception 'Slony-I: set % not found', p_set_id; end if; if v_set_origin <> getLocalNodeId('_schemadoc') then raise exception 'Slony-I: set % does not originate on local node', p_set_id; end if; -- ---- -- Create a SYNC event, run the script and generate the DDL_SCRIPT event -- ---- perform createEvent('_schemadoc', 'SYNC', NULL); perform ddlScript_int(p_set_id, p_script, p_only_on_node); perform updateRelname(p_set_id, p_only_on_node); return createEvent('_schemadoc', 'DDL_SCRIPT', p_set_id, p_script, p_only_on_node); end;