1.102.  setdroptable( integer )

Propriétés de la fonction
Langage: PLPGSQL
Type du code retour: bigint

Supprime la table tab_id de l'ensemble sur le nœud origine, et génère un événement SET_DROP_TABLE pour propager cette suppression aux autres nœuds.

declare
        p_tab_id                alias for $1;
        v_set_id                int4;
        v_set_origin            int4;
begin
        -- ----
        -- Grab the central configuration lock
        -- ----
        lock table sl_config_lock;

        -- ----
        -- Determine the set_id
        -- ----
        select tab_set into v_set_id from sl_table where tab_id = p_tab_id;

        -- ----
        -- Ensure table exists
        -- ----
        if not found then
                raise exception 'Slony-I: setDropTable_int(): table % not found',
                        p_tab_id;
        end if;

        -- ----
        -- Check that we are the origin of the set
        -- ----
        select set_origin into v_set_origin
                        from sl_set
                        where set_id = v_set_id;
        if not found then
                raise exception 'Slony-I: setDropTable(): set % not found', v_set_id;
        end if;
        if v_set_origin != getLocalNodeId('_schemadoc') then
                raise exception 'Slony-I: setDropTable(): set % has remote origin', v_set_id;
        end if;

        -- ----
        -- Drop the table from the set and generate the SET_ADD_TABLE event
        -- ----
        perform setDropTable_int(p_tab_id);
        return  createEvent('_schemadoc', 'SET_DROP_TABLE', 
                                p_tab_id::text);
end;