Olá,

Estou querendo fazer um dump do mínimo necessário (para ambiente de testes).

Seria interessante ter as últimas 1000 rows por exemplo das tabelas.

Então estava pensando em algo:

> pg_dump dbname --schema-only -f db_schema.sql


CREATE OR REPLACE FUNCTION _save_top_1000_row_tables(chemin file_path)
>  RETURNS character varying AS
> $BODY$declare
> _temps timestamp without time zone;
> begin
> execute 'copy (SELECT * FROM table1 limit 1000 offset 0) TO ''' ||
> file_path||'table1.txt''';
> execute 'copy (SELECT * FROM table2 limit 1000 offset 0) TO ''' ||
> file_path||'table2.txt''';
> execute 'copy (SELECT * FROM table3 limit 1000 offset 0) TO ''' ||
> file_path||'table3.txt''';
> return ('OK');
> end;$BODY$
>  LANGUAGE plpgsql VOLATILE
>  COST 100;


Mas deste modo eu não teria as foreign keys certo?

Há outro modo de fazer? Alguém tem alguma ideia?

* estou usando PostgreSQL 9.2

Obrigado.
_______________________________________________
pgbr-geral mailing list
pgbr-geral@listas.postgresql.org.br
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral

Responder a