BUG #1249: pg_restore doesnt handle restoring databases not created as a superuser

From: "PostgreSQL Bugs List" <pgsql-bugs(at)postgresql(dot)org>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #1249: pg_restore doesnt handle restoring databases not created as a superuser
Date: 2004-09-10 19:14:40
Message-ID: 20040910191440.D923C5A1144@www.postgresql.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 1249
Logged by: William Schaub

Email address: talon(at)cosmic-cow(dot)net

PostgreSQL version: 7.4.3

Operating system: Slackware 10 (Linux 2.4.27)

Description: pg_restore doesnt handle restoring databases not created
as a superuser

Details:

PostgreSQL 7.4.5 (and possibly many versions before)

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.

I have prepared a patch to force reconnects to be
done as the superuser specified in the -S option if
-S if given, otherwise the current behavior is used

Since pg_restore seems to use set authorization to go back to the database
owner before it creates any objects my patch seems safe to me, but i would
like to
know if it causes problems elseware.

it can be found at http://talon.home.cosmic-cow.net/pg_restore.patch

By the way your web form doesnt list 7.4.5 as an available version in the
PostgreSQL version drop down list.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PostgreSQL Bugs List 2004-09-10 19:28:23 BUG #1250: compilation fails in src/backend/storage/lmgr/s_lock.c
Previous Message Tom Lane 2004-09-10 14:24:00 Re: PosgreSQL is crashing with a signal 11 - Bug?