## 1.36. determineidxnameserial( text )

Function Properties
Language: PLPGSQL
Return Type: name

determineIdxnameSerial (tab_fqname) Given a tablename, construct the index name of the serial column.

    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;