Era isso mesmo Euler, muito obrigado.

Abraços



Enviado com MailTrack
<https://mailtrack.io/install?source=signature&lang=pt&[email protected]&idSignature=24>

2015-11-16 11:12 GMT-02:00 Euler Taveira <[email protected]>:

> On 16-11-2015 08:31, Bruno Felipe wrote:
>
>> Mais onde ele ficaria melhor para ler e converter tabela a tabela?
>>
>> Eu não entendi... mas o laço ficaria:
>
> CREATE OR REPLACE FUNCTION teste() RETURNS SETOF record
>     LANGUAGE plpgsql
>     AS $$
> DECLARE
> tabela CURSOR IS SELECT relname FROM pg_stat_user_tables ORDER BY relname;
> BEGIN
>         FOR i IN tabela LOOP
>                 EXECUTE 'COPY (SELECT row_to_json(t) FROM (SELECT * FROM '
> || quote_ident(i.relname) || ') t) TO ''/tmp/' || i.relname || '.sql''';
>         END LOOP;
> END;
> $$;
>
>
>
> --
>    Euler Taveira                   Timbira - http://www.timbira.com.br/
>    PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento
> _______________________________________________
> pgbr-geral mailing list
> [email protected]
> https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral
>



-- 
*Bruno da Cunha Felipe*
_______________________________________________
pgbr-geral mailing list
[email protected]
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral

Responder a