Re: pg_dump vs schemas

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

On Mon, 2007-07-16 at 14:58 -0400, Francisco Reyes wrote:
> One possible way may be:
> Dump the source schema.
> Remove references to the schema name in the pg_dump file.
> Change search_path and restore schema.

That's what I currently do. It seems a little flimsy though: there are
too many objects to really remove the references by hand, so we do a
global search-and-replace. As long as the schema name is unique enough,
I suppose it's alright for a development (non-production) database.

> > How do other people do that? Is it worth trying to add a way for
> > pg_restore to rename object?
>
> In the particular case that you mentioned, if pg_dump could be made to not
> include the schema name anywhere that should make the process easier.

That's what I was thinking. It might be better placed in pg_restore
though, so that way you can decide after you've already made the backup.

Regards,
Jeff Davis

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Steve Atkins 2007-07-16 19:12:30 Re: What's the logical counterpart of the to_hex function?
Previous Message Tom Lane 2007-07-16 19:06:07 Re: Moved postgres, now won't start