関数特性
言語: PLPGSQL
戻り値: bigint
subscribeSet (sub_set, sub_provider, sub_receiver, sub_forward) レシーバがプロバイダでない事を確認し、購読を格納し、他のノードに対して SUBSCRIBE_SET 事象を発行します。declare p_sub_set alias for $1; p_sub_provider alias for $2; p_sub_receiver alias for $3; p_sub_forward alias for $4; v_set_origin int4; v_ev_seqno int8; begin -- ---- -- 中枢構成のロックの取得 -- ---- lock table sl_config_lock; -- ---- -- レシーバノードでこれが呼ばれるかの検査 -- ---- if p_sub_provider != getLocalNodeId('_schemadoc') then raise exception 'Slony-I: subscribeSet() must be called on provider'; end if; -- ---- -- セットのオリジンとプロバイダが遠隔かを検査 -- ---- select set_origin into v_set_origin from sl_set where set_id = p_sub_set; if not found then raise exception 'Slony-I: set % not found', p_sub_set; end if; if v_set_origin = p_sub_receiver then raise exception 'Slony-I: set origin and receiver cannot be identical'; end if; if p_sub_receiver = p_sub_provider then raise exception 'Slony-I: set provider and receiver cannot be identical'; end if; -- --- -- セットが何らかのテーブルを所有しているか検査 ー そうでなければ捕捉 ー バグ #1226 -- --- if not exists (select true from sl_table where tab_set = p_sub_set) then raise notice 'subscribeSet:: set % has no tables - risk of problems - see bug 1226', p_sub_set; raise notice 'http://gborg.postgresql.org/project/slony1/bugs/bugupdate.php?1226'; end if; -- ---- -- SUBSCRIBE_SET 事象の作成 -- ---- v_ev_seqno := createEvent('_schemadoc', 'SUBSCRIBE_SET', p_sub_set, p_sub_provider, p_sub_receiver, case p_sub_forward when true then 't' else 'f' end); -- ---- -- 購読を格納するため内部プロシージャを呼び出し -- ---- perform subscribeSet_int(p_sub_set, p_sub_provider, p_sub_receiver, p_sub_forward); -- ---- -- 監視管理事象の発行 -- ---- perform RebuildListenEntries(); return v_ev_seqno; end;