Re: pg_dump vs schemas

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Michael Glaesemann <grzm(at)seespotcode(dot)net>
Cc: Francisco Reyes <lists(at)stringsutils(dot)com>, PostgreSQL general <pgsql-general(at)postgresql(dot)org>
Subject: Re: pg_dump vs schemas
Date: 2007-07-16 17:23:37
Message-ID: 1184606617.16532.8.camel@dogma.ljc.laika.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, 2007-07-13 at 20:06 -0500, Michael Glaesemann wrote:
> On Jul 13, 2007, at 19:10 , Francisco Reyes wrote:
>
> > Alternatively is there any easy way to take all data in one schema
> > and load it into a target DB and a different schema?
>
> You might try using the -n flag with pg_dump, replace schema1 with
> schema2 in the dump file, and loading the altered dump into the new
> database. There may also be some tricks you can play with pg_restore
> (on a dump file created with pg_dump -Fc), though I don't know
> specifically what offhand.
>

I would find it helpful if there were an easy way to rename objects
(specifically schemas) during the restore process.

Let's say I have a development database, and I want to copy the entire
schema myapp_dev1 to schema myapp_dev2 on the same database. Currently,
it's fairly awkward to do that.

How do other people do that? Is it worth trying to add a way for
pg_restore to rename object? Or what about an option so pg_restore will
not emit the the schema name at all, and the user who restores is can
just set their search_path to where they want all the objects to go?

Regards,
Jeff Davis

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Shruthi A 2007-07-16 17:40:36 Altering a plan
Previous Message Richard Broersma Jr 2007-07-16 16:09:32 Re: Postgres Geometry