pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David Garamond <davidgaramond@gmail.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Restoring a database as another user
Date: Fri, 28 Apr 2006 10:25:30 -0400
Message-ID: <688.1146234330@sss.pgh.pa.us> (raw)
In-Reply-To: <7c33d060604280017v43b0e35au2662bd9a9b40350@mail.gmail.com>
References: <7c33d060604280017v43b0e35au2662bd9a9b40350@mail.gmail.com>

"David Garamond" <davidgaramond@gmail.com> writes:
> My goal is to restore someone's (e.g. Jim's) database by the superuser to be
> owned by a new user (e.g. Bob). Jim and Bob connects using password and I
> (the superuser) do not know their passwords.

I think you'd need a two-step process:

	pg_restore --no-owner mydb.dump >mydb.script

	psql -U superuser template1
	psql=> create database foo owner bob;
	psql=> \c foo
	psql=> set session authorization bob;
	psql=> \i mydb.script


			regards, tom lane



view thread (2+ messages)

Message-ID: <688.1146234330@sss.pgh.pa.us>
Permalink:  ../688.1146234330@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/688.1146234330@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, davidgaramond@gmail.com
  Subject: Re: Restoring a database as another user
  In-Reply-To: <688.1146234330@sss.pgh.pa.us>
  References: <7c33d060604280017v43b0e35au2662bd9a9b40350@mail.gmail.com> <688.1146234330@sss.pgh.pa.us>

* 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