1.39.  ddlscript_prepare( integer, integer )

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

Prépare l'exécution du script DDL sur l'origine.

declare
        p_set_id                        alias for $1;
        p_only_on_node          alias for $2;
        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);
        return 1;
end;