pg_dump fails to set index ownership - Mailing list pgsql-bugs

From Michael Fuhr
Subject pg_dump fails to set index ownership
Date
Msg-id 20050111022852.GA7955@winnie.fuhr.org
Whole thread Raw
Responses Re: pg_dump fails to set index ownership  (Michael Fuhr <mike@fuhr.org>)
List pgsql-bugs
PostgreSQL 8.0.0rc4

pg_dump fails to set ownership on indexes.  When a database superuser
restores a dump, indexes will be owned by the superuser instead of
by the table's owner.  The table owner will then be unable to drop
or alter the index.

Here's how to reproduce:

createuser -Upostgres -PAD testuser
createdb -Upostgres test
psql -Utestuser test
CREATE TABLE foo (id serial PRIMARY KEY, name text);
CREATE INDEX foo_name_idx ON foo (name);
\q
pg_dump -Upostgres test > test.sql
dropdb -Upostgres test
createdb -Upostgres test
psql -Upostgres test < test.sql
psql -Utestuser test
\di
                List of relations
 Schema |     Name     | Type  |  Owner   | Table
--------+--------------+-------+----------+-------
 public | foo_name_idx | index | postgres | foo
 public | foo_pkey     | index | postgres | foo
(2 rows)

DROP index foo_name_idx;
ERROR:  must be owner of relation foo_name_idx

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: tsearch2 headline function fails to parse integer arguments
Next
From: Michael Fuhr
Date:
Subject: Re: pg_dump fails to set index ownership