pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Setting Schema on Restore
3+ messages / 2 participants
[nested] [flat]

* Setting Schema on Restore
@ 2010-11-30 05:16 Samuel Stearns <SStearns@internode.com.au>
  2010-11-30 15:06 ` Re: Setting Schema on Restore Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 3+ messages in thread

From: Samuel Stearns @ 2010-11-30 05:16 UTC (permalink / raw)
  To: pgsql-admin

Howdy,

Environment:

Solaris 10
Postgres 8.3.11

I'm running a dump/restore in a shell script.  There are 3 machines involved.  Host1 where the shell script is being run from, host2 where the database is being dumped from, host3 where the database is being restored to.  Shell script looks like this:

/usr/postgres/8.3/bin/pg_dump -h <host2> <database> | /usr/postgres/8.3/bin/psql -h <host3> <database>

I want to restore into a specific schema.  Psql does not provide a switch for this.  I tried this before the pg_dump command above:

Echo "
SET search_path TO <schema>;
" | /usr/postgres/8.3/bin/psql -h <host3> <database>

Which didn't work.  I also tried this before the pg_dump command:

PGOPTIONS="-search_path=<schema>"

Which doesn't work due to the script running from a different machine.

Does anyone have any ideas on how I can achieve this, please?

Thank you,

Sam

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Setting Schema on Restore
  2010-11-30 05:16 Setting Schema on Restore Samuel Stearns <SStearns@internode.com.au>
@ 2010-11-30 15:06 ` Tom Lane <tgl@sss.pgh.pa.us>
  2010-11-30 23:34   ` Re: Setting Schema on Restore Samuel Stearns <SStearns@internode.com.au>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2010-11-30 15:06 UTC (permalink / raw)
  To: Samuel Stearns <SStearns@internode.com.au>; +Cc: pgsql-admin

Samuel Stearns <SStearns@internode.com.au> writes:
> I want to restore into a specific schema.

The only way to do that is to hand-edit the dump script.

If you're feeling brave you could try letting "sed" do it; but
unless the schema name being replaced is pretty unusual, the
risk of false matches seems high.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Setting Schema on Restore
  2010-11-30 05:16 Setting Schema on Restore Samuel Stearns <SStearns@internode.com.au>
  2010-11-30 15:06 ` Re: Setting Schema on Restore Tom Lane <tgl@sss.pgh.pa.us>
@ 2010-11-30 23:34   ` Samuel Stearns <SStearns@internode.com.au>
  0 siblings, 0 replies; 3+ messages in thread

From: Samuel Stearns @ 2010-11-30 23:34 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-admin

Thanks, Tom!

-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us] 
Sent: Wednesday, 1 December 2010 1:37 AM
To: Samuel Stearns
Cc: pgsql-admin@postgresql.org
Subject: Re: [ADMIN] Setting Schema on Restore 

Samuel Stearns <SStearns@internode.com.au> writes:
> I want to restore into a specific schema.

The only way to do that is to hand-edit the dump script.

If you're feeling brave you could try letting "sed" do it; but
unless the schema name being replaced is pretty unusual, the
risk of false matches seems high.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2010-11-30 23:34 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-11-30 05:16 Setting Schema on Restore Samuel Stearns <SStearns@internode.com.au>
2010-11-30 15:06 ` Tom Lane <tgl@sss.pgh.pa.us>
2010-11-30 23:34   ` Samuel Stearns <SStearns@internode.com.au>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox