Re: Feature request : add REMAP_SCHEMA-like option to pg_restore

Lists: pgsql-hackers
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
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


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Jean-Paul Argudo <jean-paul(at)postgresqlfr(dot)org>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Feature request : add REMAP_SCHEMA-like option to pg_restore
Date: 2009-08-31 14:21:39
Message-ID: 603c8f070908310721q5de818a0ja2ba07060fc3bea8@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, Aug 31, 2009 at 9:59 AM, Jean-Paul
Argudo<jean-paul(at)postgresqlfr(dot)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


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Jean-Paul Argudo <jean-paul(at)postgresqlfr(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Feature request : add REMAP_SCHEMA-like option to pg_restore
Date: 2009-08-31 14:42:26
Message-ID: 4A9BE152.80701@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Robert Haas wrote:
> On Mon, Aug 31, 2009 at 9:59 AM, Jean-Paul
> Argudo<jean-paul(at)postgresqlfr(dot)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


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Jean-Paul Argudo <jean-paul(at)postgresqlfr(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Feature request : add REMAP_SCHEMA-like option to pg_restore
Date: 2009-08-31 15:06:43
Message-ID: 603c8f070908310806o36bdfdcdla21834827bc5d468@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, Aug 31, 2009 at 10:42 AM, Andrew Dunstan<andrew(at)dunslane(dot)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