pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Samuel Stearns <SStearns@internode.com.au>
To: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
Subject: Setting Schema on Restore
Date: Tue, 30 Nov 2010 15:46:07 +1030
Message-ID: <68B59BEDCD36854AADBDF17E91B2937A0784188839@EXCHMAIL.staff.internode.com.au> (raw)

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

view thread (3+ messages)  latest in thread

Message-ID: <68B59BEDCD36854AADBDF17E91B2937A0784188839@EXCHMAIL.staff.internode.com.au>
Permalink:  ../68B59BEDCD36854AADBDF17E91B2937A0784188839@EXCHMAIL.staff.internode.com.au/
Also on:    postgresql.org/message-id/68B59BEDCD36854AADBDF17E91B2937A0784188839@EXCHMAIL.staff.internode.com.au

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: SStearns@internode.com.au
  Subject: Re: Setting Schema on Restore
  In-Reply-To: <68B59BEDCD36854AADBDF17E91B2937A0784188839@EXCHMAIL.staff.internode.com.au>
  References: <68B59BEDCD36854AADBDF17E91B2937A0784188839@EXCHMAIL.staff.internode.com.au>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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