Christopher Browne cbbrowne
Wed Apr 19 08:50:38 PDT 2006
Aaron Randall wrote:
> Thanks for the helpful replies everyone.
>
> I attempted to use the "select _my_replication.uninstallnode();" and
> this is what I saw...
>
>    ipt=# select _my_replication.uninstallnode();
>    ERROR:  Slony-I: Table with id 1 not found
>    CONTEXT:  SQL statement "SELECT   
> "_my_replication".alterTableRestore( $1 )"
>    PL/pgSQL function "uninstallnode" line 14 at perform
>
> So I had a look in "_my_replication.sl_table ;"...
>
>    ipt=# SELECT * from _my_replication.sl_table ;
>
> and table with ID 1 was atypes.  To check that the table did exists, I
> did a simple select...
>
>
>    ipt=# SELECT * from atypes ;
>     atype  |        tag         | description | mydata |       
> dateadded.........
>
>
> I'm confused! :D
>
Are you *sure* that they match?

Here's the code that returns that error...
    -- ----
    -- Get the sl_table row and the current origin of the table.
    -- Verify that the table currently is NOT in altered state.
    -- ----
    select T.tab_reloid, T.tab_set, T.tab_idxname, T.tab_altered,
            S.set_origin, PGX.indexrelid,
            @NAMESPACE at .slon_quote_brute(PGN.nspname) || ''.'' ||
            @NAMESPACE at .slon_quote_brute(PGC.relname) as tab_fqname
            into v_tab_row
            from @NAMESPACE at .sl_table T, @NAMESPACE at .sl_set S,
                "pg_catalog".pg_class PGC, "pg_catalog".pg_namespace PGN,
                "pg_catalog".pg_index PGX, "pg_catalog".pg_class PGXC
            where T.tab_id = p_tab_id
                and T.tab_set = S.set_id
                and T.tab_reloid = PGC.oid
                and PGC.relnamespace = PGN.oid
                and PGX.indrelid = T.tab_reloid
                and PGX.indexrelid = PGXC.oid
                and PGXC.relname = T.tab_idxname
                for update;
    if not found then
        raise exception ''Slony-I: Table with id % not found'', p_tab_id;
    end if;

In your case, the query could be transformed to the following, to search
for the relevant table:

    select T.tab_reloid, T.tab_set, T.tab_idxname, T.tab_altered,
            S.set_origin, PGX.indexrelid,
            "_my_replication".slon_quote_brute(PGN.nspname) || ''.'' ||
            "_my_replication".slon_quote_brute(PGC.relname) as tab_fqname
            into v_tab_row
            from "_my_replication".sl_table T, "_my_replication".sl_set S,
                "pg_catalog".pg_class PGC, "pg_catalog".pg_namespace PGN,
                "pg_catalog".pg_index PGX, "pg_catalog".pg_class PGXC
            where T.tab_id = 1
                and T.tab_set = S.set_id
                and T.tab_reloid = PGC.oid
                and PGC.relnamespace = PGN.oid
                and PGX.indrelid = T.tab_reloid
                and PGX.indexrelid = PGXC.oid
                and PGXC.relname = T.tab_idxname;

Apparently some part of the linkages there *isn't* there; it may take
several queries to figure out which bit is missing.

- You might check to see if there's a table in pg_class where the oid
matches the "tab_reloid" value in sl_table

- Similarly, you can do queries against pg_class looking for the index name

- And against pg_index, looking for the linkage between the table (one
pg_class entry) and the index (another pg_class entry).

Some part of that is missing.  Perhaps you dropped the primary key index?



More information about the Slony1-general mailing list