Re: pg_dump and schemas - Mailing list pgsql-general

From Brent Wood
Subject Re: pg_dump and schemas
Date
Msg-id 47F7D5EF0200007B0001216C@gwia1.ham.niwa.co.nz
Whole thread Raw
In response to pg_dump and schemas  (Rusty Conover <rconover@infogears.com>)
Responses Re: pg_dump and schemas  (Rusty Conover <rconover@infogears.com>)
List pgsql-general
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
creativein your use of sed, but it can pretty well always be made to do this sort of operation.  

Cheers,

   Brent Wood



>>> Rusty Conover <rconover@infogears.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@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


pgsql-general by date:

Previous
From: Troy Rasiah
Date:
Subject: Word boundaries in regular expressions
Next
From: "Guillaume Bog"
Date:
Subject: pl/pgsql RECORD data type, how to access to the values