Eu apenas experimento a solução encontrada aqui: link
E ainda tenho um erro no proprietário do objeto inexistente.
O que eu faço:
pg_dump -F c -f fnam.sql.tgz -h postgresql.bizinnov.net -U bizinnov bizinnov_fnam
pg_restore -F c --clean --no-owner --role=fnam -h localhost -U fnam -d fnam_db1 fnam.sql.tgz
O que eu recebo:
pg_restore: [archiver (db)] Error from TOC entry 148; 1259 408716672 SEQUENCE auth_group_id_seq bizinnov
pg_restore: [archiver (db)] could not execute query: ERROR: sequence "auth_group_id_seq" does not exist Command was: DROP SEQUENCE public.auth_group_id_seq;
pg_restore: [archiver (db)] Error from TOC entry 149; 1259 408716674 TABLE auth_group bizinnov
pg_restore: [archiver (db)] could not execute query: ERROR: table "auth_group" does not exist Command was: DROP TABLE public.auth_group;
pg_restore: [archiver (db)] Error from TOC entry 6; 2615 2200 SCHEMA public postgres
pg_restore: [archiver (db)] could not execute query: ERROR: must be owner of schema public Command was: DROP SCHEMA public;
pg_restore: [archiver (db)] could not execute query: ERROR: schema "public" already exists Command was: CREATE SCHEMA public;
pg_restore: [archiver (db)] Error from TOC entry 2029; 0 0 COMMENT SCHEMA public postgres
pg_restore: [archiver (db)] could not execute query: ERROR: must be owner of schema public Command was: COMMENT ON SCHEMA public IS 'standard public schema';
pg_restore: WARNING: no privileges could be revoked for "public"
pg_restore: WARNING: no privileges could be revoked for "public"
pg_restore: WARNING: no privileges were granted for "public"
pg_restore: [archiver (db)] Error from TOC entry 2030; 0 0 ACL public postgres
pg_restore: [archiver (db)] could not execute query: ERROR: role "bizinnov" does not exist Command was: REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO
postgres; ... WARNING: errors ignored on restore: 125
Tags postgresql database restore