I have a Postgres database and I would like to copy certain tables from a single schema into a new empty database.

So far I have copied a schema-only dump from from the old DB and applied it to a new empty DB.

I have also created a data-only dump of the specific tables I want using -t [table-name].

Unfortunately the tables are owned by different roles, so when I try to restore the DB or modify the schema prior to data loading, I am getting all kinds of errors.

My guess is that I need to do some kind of check/modification of roles prior to creating the dumps.

What is the correct process for duplicating part of a DB including roles? - keeping in mind tables could have different owners.


You could perform the pg_dump with the parameters --no-owner and --no-acl, so no permissions or links to any users are presents in the dump.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.