Re: pg_dump and schemas

From: Rusty Conover <rconover(at)infogears(dot)com>
To: "Brent Wood" <b(dot)wood(at)niwa(dot)co(dot)nz>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: pg_dump and schemas
Date: 2008-04-05 13:11:38
Message-ID: 8D42EDA9-DB1D-4A15-BA6B-2E04FE4EA8EC@infogears.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Brent,

It's not he best solution, because we could have fields containing
"public" in their names and sed would happily change those to test1 as
well.

I'm looking for a safer solution, thats why it should be a part of
pg_dump.

Rusty

On Apr 5, 2008, at 12:41 AM, Brent Wood wrote:

> Hi Rusty,
>
> Try passing the output through a utility like sed, already there
> under Linux , but versions that work under Windows are available
> (eg, cygwin)
>
> eg, using a pipe: pg_dump -d.... | sed 's/public/test1/g' > dump.sql
>
> or converting a pg_dump output file:
>
> pg_dump <creates dump.sql>
> cat dump.sql | sed 's/public/test1/g' > dump2.sql
>
> With tools like these freely available, you don't really need to
> spend time reinventing them in your database applications. Of
> course. if you have the "public" schema name used elsewhere in your
> database, you may need to get a bit creative in your use of sed, but
> it can pretty well always be made to do this sort of operation.
>
> Cheers,
>
> Brent Wood
>
>
>
>>>> Rusty Conover <rconover(at)infogears(dot)com> 05/04/08 8:42 AM >>>
> Hi All,
>
> Is there a way to pass a parameter to pg_dump that would make the
> produced dump be loaded into a different schema rather then the one it
> is being dumped from? Basically be able to say dump out of public,
> but write the dump so its restored to say "test1".
>
> Thanks,
>
> Rusty
> --
> Rusty Conover
> InfoGears Inc.
> http://www.infogears.com
>
>
>
>
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

--
Rusty Conover
InfoGears Inc.
http://www.infogears.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Guillaume Bog 2008-04-05 13:28:26 Re: pl/pgsql RECORD data type, how to access to the values
Previous Message Tom Allison 2008-04-05 12:15:16 mac ports question