pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedRestoring a database as another user
2+ messages / 2 participants
[nested] [flat]
* Restoring a database as another user
@ 2006-04-28 07:17 David Garamond <davidgaramond@gmail.com>
2006-04-28 14:25 ` Re: Restoring a database as another user Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 2+ messages in thread
From: David Garamond @ 2006-04-28 07:17 UTC (permalink / raw)
To: pgsql-admin
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.
Is it possible to do pg_restore, connecting as the superuser, specifying
--no-owner, but making so that all objects now be owned by the new user (e.g.
Bob)? Or do I have to resort to other tricks (like doing ALTER OWNER later,
or modifying pg_hba.conf temporarily so the superuser can connect as Jim
without a password)?
Regards,
Dave
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Restoring a database as another user
2006-04-28 07:17 Restoring a database as another user David Garamond <davidgaramond@gmail.com>
@ 2006-04-28 14:25 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2006-04-28 14:25 UTC (permalink / raw)
To: David Garamond <davidgaramond@gmail.com>; +Cc: pgsql-admin
"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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2006-04-28 14:25 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-04-28 07:17 Restoring a database as another user David Garamond <davidgaramond@gmail.com>
2006-04-28 14:25 ` Tom Lane <tgl@sss.pgh.pa.us>
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