Re: BUG #1249: pg_restore doesnt handle restoring databases not created as a superuser - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #1249: pg_restore doesnt handle restoring databases not created as a superuser
Date
Msg-id 28667.1094844776@sss.pgh.pa.us
Whole thread Raw
In response to BUG #1249: pg_restore doesnt handle restoring databases not created as a superuser  ("PostgreSQL Bugs List" <pgsql-bugs@postgresql.org>)
Responses Re: BUG #1249: pg_restore doesnt handle restoring databases  (Bill Schaub <talon@cosmic-cow.net>)
List pgsql-bugs
"PostgreSQL Bugs List" <pgsql-bugs@postgresql.org> writes:
> When restoring databases with pg_restore with the -C
> option it will connect to template1, set authorization to
> the user that created the database and then reconnect
> as the user that created the database to the new database. this is where the
> trouble starts, from here on
> it trys to set authorization back to the superuser to
> do grant and revoke. this will cause the restore to fail.

Hmm.  This is still broken in CVS tip, but I think the correct solution
is just to replace "\connect db user" with "\connect db" everywhere.
This will retain the starting real user authentication throughout the
restore process.  We have completely abandoned use of \connect to change
authorization, and this seems just an unintentional hangover from the
old way.

            regards, tom lane

pgsql-bugs by date:

Previous
From: "PostgreSQL Bugs List"
Date:
Subject: BUG #1250: compilation fails in src/backend/storage/lmgr/s_lock.c
Next
From: Tom Lane
Date:
Subject: Re: BUG #1250: compilation fails in src/backend/storage/lmgr/s_lock.c