Feature request : add REMAP_SCHEMA-like option to pg_restore

From: Jean-Paul Argudo <jean-paul(at)postgresqlfr(dot)org>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Feature request : add REMAP_SCHEMA-like option to pg_restore
Date: 2009-08-31 13:59:40
Message-ID: 4A9BD74C.6010904@postgresqlfr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2009-08-31 14:00:50 Re: Bison crashes postgresql
Previous Message Tom Lane 2009-08-31 13:54:01 Re: combined indexes with Gist - planner issues?