X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 6EA2E11F6067 for ; Fri, 28 Apr 2006 11:25:41 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 82434-05 for ; Fri, 28 Apr 2006 11:25:33 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 7C77711F605C for ; Fri, 28 Apr 2006 11:25:31 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k3SEPULk000689; Fri, 28 Apr 2006 10:25:30 -0400 (EDT) To: "David Garamond" cc: pgsql-admin@postgresql.org Subject: Re: Restoring a database as another user In-reply-to: <7c33d060604280017v43b0e35au2662bd9a9b40350@mail.gmail.com> References: <7c33d060604280017v43b0e35au2662bd9a9b40350@mail.gmail.com> Comments: In-reply-to "David Garamond" message dated "Fri, 28 Apr 2006 14:17:30 +0700" Date: Fri, 28 Apr 2006 10:25:30 -0400 Message-ID: <688.1146234330@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200604/331 X-Sequence-Number: 21500 "David Garamond" 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