Setting Schema on Restore

From: Samuel Stearns <SStearns(at)internode(dot)com(dot)au>
To: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Setting Schema on Restore
Date: 2010-11-30 05:16:07
Message-ID: 68B59BEDCD36854AADBDF17E91B2937A0784188839@EXCHMAIL.staff.internode.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Lello, Nick 2010-11-30 10:17:45 Best Linux filesystem for Postgres data store ?
Previous Message Anderson Valadares 2010-11-30 00:42:37 Re: failed to re-find parent key in index "22723655" for split pages 370836/370837