dump & restore to different schema

From: Craig de Stigter <craig(dot)destigter(at)koordinates(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: dump & restore to different schema
Date: 2011-05-19 02:10:28
Message-ID: BANLkTin_51LMKJWoXVhVvPGVKgmt2Dfbkw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi list

We're writing a plugin for our website that loads single-table database
dumps created by untrusted users. My question is two-fold:

1. I'm assuming that the dump format can contain arbitrary sql commands, so
a pg_restore of this nature should be run under an untrusted account in its
own restricted schema. Can someone confirm that this is the case?

2. The dump is presumed to contain exactly one table, which I want to load
into my restricted schema. But it seems pg_restore has no option to set the
schema during restoration. It always loads into the original schema as
stored in the dump. How can I get around this?

I would prefer not to use s/^SET search_path.*$/SET search_path TO
untrusted_schema/g if I can avoid it ;)

Thanks
Craig de Stigter

--
Koordinates Ltd
PO Box 1604, Shortland St, Auckland, New Zealand
Phone +64-9-966 0433 Fax +64-9-969 0045
Web http://www.koordinates.com

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Craig Ringer 2011-05-19 02:17:42 Re: SSDD reliability
Previous Message Craig Ringer 2011-05-19 02:08:05 Re: question about readonly instances