関数特性
言語: PLPGSQL
戻り値: bigint
ddlScript(set_id, script, only_on_node) SYNC 事象を生成し、オリジンノードでスクリプトを実行し、そして複製されたスレーブ上でそれが実行されるように要求する DDL_SCRIPT 事象を生成します。declare
p_set_id alias for $1;
p_script alias for $2;
p_only_on_node alias for $3;
v_set_origin int4;
begin
-- ----
-- 中枢構成にロックを取得
-- ----
lock table sl_config_lock;
-- ----
-- セットが存在しここで発生したかの検査
-- ----
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;
-- ----
-- SYNC 事象の作成、スクリプトを実行し、 DDL_SCRIPT 事象を生成
-- ----
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;