Re: Dump tables with pg_dump - no or different Owner

From: Alex Satrapa <alex(at)lintelsys(dot)com(dot)au>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Dump tables with pg_dump - no or different Owner
Date: 2004-01-12 22:31:06
Message-ID: 4003202A.5070201@lintelsys.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Victor Spång Arthursson wrote:
> Have a problem, probably easy to solve... I want to dump a database
> which resides on my local server with another, and not existing, owner
> than the one who actually owns it locally.

If the whole database is going to be owned by one user, try dumping the
tables like this:

pg_dump --no-privileges --no-owner --no-reconnect ... > tables.sql

Then load the tables as the new owner on the new database.

An alternative is to process the SQL dump using perl:

perl -p -i -e 's/old-owner-name/new-owner-name/g' tables.sql

HTH
Alex Satrapa

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2004-01-12 22:31:26 Re: Vacuum Error
Previous Message scott.marlowe 2004-01-12 22:27:26 Re: Vacuum Error