Setting Schema on Restore - Mailing list pgsql-admin

From Samuel Stearns
Subject Setting Schema on Restore
Date
Msg-id 68B59BEDCD36854AADBDF17E91B2937A0784188839@EXCHMAIL.staff.internode.com.au
Whole thread Raw
Responses Re: Setting Schema on Restore  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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

 

 

pgsql-admin by date:

Previous
From: Anderson Valadares
Date:
Subject: Re: failed to re-find parent key in index "22723655" for split pages 370836/370837
Next
From: Evan Sarmiento
Date:
Subject: LDAP AUTH / IDENT question