Error creating index on PostgreSQL 9.1
You will need to assign ownership of the table to the group the two users have in common.

Demo:

Setup:

CREATE ROLE thegroup;
CREATE USER user1 IN ROLE thegroup;
CREATE USER user2 IN ROLE thegroup;
CREATE TABLE t1 ( x integer not null );
ALTER TABLE t1 OWNER TO user1;


Without further changes, here's what happens if user2 tries to add an index on t1.x:

regress=# SET ROLE user2;
SET
regress=&gt; CREATE INDEX t1_x_idx ON t1(x);
ERROR:  must be owner of relation t1


The solution is to grant the table ownership to the shared role. As user1 or a superuser:

ALTER TABLE t1 OWNER TO thegroup;


now:

regress=# SET ROLE user2;
SET
regress=&gt; CREATE INDEX t1_x_idx ON t1(x);
CREATE INDEX
regress=&gt;