Skip site navigation (1) Skip section navigation (2)

pg_dump fails to set index ownership

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: pgsql-bugs(at)postgresql(dot)org
Subject: pg_dump fails to set index ownership
Date: 2005-01-11 02:28:52
Message-ID: 20050111022852.GA7955@winnie.fuhr.org (view raw or flat)
Thread:
Lists: 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/

Responses

pgsql-bugs by date

Next:From: Michael FuhrDate: 2005-01-11 03:43:17
Subject: Re: pg_dump fails to set index ownership
Previous:From: Ivan ChumakDate: 2005-01-10 15:31:53
Subject: BUG #1380: dont reading messages in russian languages

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group