関数特性
言語: PLPGSQL
戻り値: bigint
レプリケーションからノード node_id を削除する DROP_NODE 事象の生成。declare
p_no_id alias for $1;
v_node_row record;
begin
-- ----
-- 中枢構成にロックの取得
-- ----
lock table sl_config_lock;
-- ----
-- 異なったノードで呼ばれたかの検査
-- ----
if p_no_id = getLocalNodeId('_schemadoc') then
raise exception 'Slony-I: DROP_NODE cannot initiate on the dropped node';
end if;
select * into v_node_row from sl_node
where no_id = p_no_id
for update;
if not found then
raise exception 'Slony-I: unknown node ID %', p_no_id;
end if;
-- ----
-- これにより他のノード記述を壊していないかの確認
-- ----
if exists (select true from sl_subscribe
where sub_provider = p_no_id)
then
raise exception 'Slony-I: Node % is still configured as data provider',
p_no_id;
end if;
-- ----
-- セットがもう発生しないかの確認
-- ----
if exists (select true from sl_set
where set_origin = p_no_id)
then
raise exception 'Slony-I: Node % is still origin of one or more sets',
p_no_id;
end if;
-- ----
-- 内部の削除機能の呼び出しと事象の生成
-- ----
perform dropNode_int(p_no_id);
return createEvent('_schemadoc', 'DROP_NODE',
p_no_id);
end;