1.46.  determineidxnameserial( text )

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

Suivant le nom d'une table, construit un nom d'index de la colonne de type serial.

declare
        p_tab_fqname    alias for $1;
        v_tab_fqname_quoted     text default '';
        v_row                   record;
begin
        v_tab_fqname_quoted := slon_quote_input(p_tab_fqname);
        --
        -- Lookup the table name alone
        --
        select PGC.relname
                        into v_row
                        from "pg_catalog".pg_class PGC,
                                "pg_catalog".pg_namespace PGN
                        where slon_quote_brute(PGN.nspname) || '.' ||
                                slon_quote_brute(PGC.relname) = v_tab_fqname_quoted
                                and PGN.oid = PGC.relnamespace;
        if not found then
                raise exception 'Slony-I: table % not found',
                                v_tab_fqname_quoted;
        end if;

        --
        -- Return the found index name
        --
        return v_row.relname || '__Slony-I_schemadoc_rowID_key';
end;