1.29.  copyfields( integer )

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

Renvoie une chaîne consistant à ce qui doit être ajoutée à une instruction COPY pour spécifier les champs pour le tab_id. Dans les versions ultérieurs à PostgreSQL 7.3, cela ressemble à (field1, field2,...fieldn)

declare
        result text;
        prefix text;
        prec record;
begin
        result := '';
        prefix := '(';   -- Initially, prefix is the opening paren

        for prec in select slon_quote_input(a.attname) as column from sl_table t, pg_catalog.pg_attribute a where t.tab_id = $1 and t.tab_reloid = a.attrelid and a.attnum > 0 and a.attisdropped = false order by attnum
        loop
                result := result || prefix || prec.column;
                prefix := ',';   -- Subsequently, prepend columns with commas
        end loop;
        result := result || ')';
        return result;
end;