Feature request : add REMAP_SCHEMA-like option to pg_restore

Started by Jean-Paul Argudoover 16 years ago4 messages
#1Jean-Paul Argudo
jean-paul@postgresqlfr.org

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

#2Robert Haas
robertmhaas@gmail.com
In reply to: Jean-Paul Argudo (#1)
Re: Feature request : add REMAP_SCHEMA-like option to pg_restore

On Mon, Aug 31, 2009 at 9:59 AM, Jean-Paul
Argudo<jean-paul@postgresqlfr.org> wrote:

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.

Well, you have a much better chance of having it happen if you write
the patch... people are usually willing to tell you what you did
wrong and give a few hints out to fix it.

...Robert

#3Andrew Dunstan
andrew@dunslane.net
In reply to: Robert Haas (#2)
Re: Feature request : add REMAP_SCHEMA-like option to pg_restore

Robert Haas wrote:

On Mon, Aug 31, 2009 at 9:59 AM, Jean-Paul
Argudo<jean-paul@postgresqlfr.org> wrote:

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.

Well, you have a much better chance of having it happen if you write
the patch... people are usually willing to tell you what you did
wrong and give a few hints out to fix it.

Or pay someone to do it. I gather this requirement is from a commercial
user. There are plenty of hired guns available.

AIUI the requirement doesn't seem very difficult or complex

cheers

andrew

#4Robert Haas
robertmhaas@gmail.com
In reply to: Andrew Dunstan (#3)
Re: Feature request : add REMAP_SCHEMA-like option to pg_restore

On Mon, Aug 31, 2009 at 10:42 AM, Andrew Dunstan<andrew@dunslane.net> wrote:

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.

Well, you have a much better chance of having it happen if you write
the patch...  people are usually willing to tell you what you did
wrong and give a few hints out to fix it.

Or pay someone to do it. I gather this requirement is from a commercial
user. There are plenty of hired guns available.

Yep, that works too.

...Robert