Feature request : add REMAP_SCHEMA-like option to pg_restore - Mailing list pgsql-hackers

From Jean-Paul Argudo
Subject Feature request : add REMAP_SCHEMA-like option to pg_restore
Date
Msg-id 4A9BD74C.6010904@postgresqlfr.org
Whole thread Raw
Responses Re: Feature request : add REMAP_SCHEMA-like option to pg_restore  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Hi there,


I searched the wiki and the lists about the REMAP_SCHEMA option's idea
of a well known RDBMS, since its 10g version.

Here's the short description:

REMAP_SCHEMA : Objects from one schema are loaded into another schema.

The idea is when we have a given schema (let's say this schema is
"prod") in a dump (custom format, done with pg_dump -Fc) we want to
restore it in another schema with a different name (let's say this
target schema is "prod_copy").

With the "clean" option this would give a user restoring a "production"
schema into a "test" (or dev, whatever) schema an easy way to refresh
the schema.

For sure at the moment there are workarounds, like creating the same
"prod" schema in the "development" database, and then rename it with an
alter. But this could be done automatically with options to pg_restore like:
 pg_restore [...] --remap_schema=source_schema:target_schema [...]

or something like
 pg_restore [...] --from_schema=source_schema --to_schema=target_schema
[...]

Well, I think you get the idea. What do you think of it ?

No need to say that the need comes from a big company using this RDBMS
in version 10g willing to migrate to PostgreSQL and
not-adapt-that-much-things to have their habits with this RDBMS not-that
much changed.

(yes, they use REMAP_SCHEMA a lot)

Hope you find the idea interesting. I'm willing to test anything or add
more specification to the feature. I must admit too this is a patch I'd
like to write too (it would be my very first) but I don't know if my C
skills are good enough to do so.

Cheers,

-- 
Jean-Paul Argudo
www.PostgreSQL.fr
www.Dalibo.com




pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: combined indexes with Gist - planner issues?
Next
From: Andrew Dunstan
Date:
Subject: Re: Bison crashes postgresql