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/