I'm trying to remove the role my_schema-writers. I can't because it owns objects:
ERROR: role "my_schema-writers" cannot be dropped because some objects depend on it
DETAIL: privileges for table your_schema.your_table
1101 objects in database *******
1 object in database *******
1 object in database *******
1 object in database *******
1 object in database *******
Sure enough, it has privileges:
my_database=# \dp your_schema.your_table
Access privileges
┌─────────────┬───────────────────┬───────┬────────────────────────────────────────────────────────────┬───────────────────┐
│ Schema │ Name │ Type │ Access privileges │ Column privileges │
├─────────────┼───────────────────┼───────┼────────────────────────────────────────────────────────────┼───────────────────┤
│ your_schema │ your_table │ table │ "your_schema-writers"=arwdDxt/"your_schema-writers" ↵│ │
│ │ │ │ "***-writers"=arwdDxt/"your_schema-writers" ↵│ │
│ │ │ │ "server-superusers"=a*r*w*d*D*x*t*/"your_schema-writers" ↵│ │
│ │ │ │ "server-writers"=arwdDxt/"server-superusers" ↵│ │
│ │ │ │ =r/"server-superusers" ↵│ │
│ │ │ │ "my_schema-writers"=rx/"server-superusers" │ │
└─────────────┴───────────────────┴───────┴────────────────────────────────────────────────────────────┴───────────────────┘
(1 row)
That is, role my_schema-writers has privileges on your_schema.your_table.
I can revoke all privileges:
my_database=# REVOKE ALL ON TABLE your_schema.your_table FROM "my_schema-writers";
Time: 1.884 ms
But the privileges persist:
my_database=# \dp your_schema.your_table
Access privileges
┌─────────────┬───────────────────┬───────┬────────────────────────────────────────────────────────────┬───────────────────┐
│ Schema │ Name │ Type │ Access privileges │ Column privileges │
├─────────────┼───────────────────┼───────┼────────────────────────────────────────────────────────────┼───────────────────┤
│ your_schema │ your_table │ table │ "your_schema-writers"=arwdDxt/"your_schema-writers" ↵│ │
│ │ │ │ "***-writers"=arwdDxt/"your_schema-writers" ↵│ │
│ │ │ │ "server-superusers"=a*r*w*d*D*x*t*/"your_schema-writers" ↵│ │
│ │ │ │ "server-writers"=arwdDxt/"server-superusers" ↵│ │
│ │ │ │ =r/"server-superusers" ↵│ │
│ │ │ │ "my_schema-writers"=rx/"server-superusers" │ │
└─────────────┴───────────────────┴───────┴────────────────────────────────────────────────────────────┴───────────────────┘
(1 row)
And I still can't remove the role:
ERROR: role "my_schema-writers" cannot be dropped because some objects depend on it
DETAIL: privileges for table your_schema.your_table
1101 objects in database *******
1 object in database *******
1 object in database *******
1 object in database *******
1 object in database *******
my_schema-writers is not a member any other role and has no member roles:
rpm_2016_02=# \du "my_schema-writers"
List of roles
┌───────────────────┬──────────────┬───────────┐
│ Role name │ Attributes │ Member of │
├───────────────────┼──────────────┼───────────┤
│ my_schema-writers │ Cannot login │ {} │
└───────────────────┴──────────────┴───────────┘
How do I remove these privileges and the role? I'm able to remove the 1101 objects and the other 4 individual 1 object... is the same table in backup databases.
I also tried DROP OWNED BY "my_schema-writers"; with no error, but still not able to drop the role.
REASSIGN/DROP OWNEDmust be run in each database and it is true that my_schema.my_table exists in the other database, but does that explain why the privileges formy_schema.my_tablein the current database aren't removed? – Dylan Hettinger Jun 09 '18 at 20:211 object in database...is always"my_schema-writers"=rx/"server-superusers"onyour_schema.your_table- the same privileges and same table. I am using a superuser role, namelyserver-superusers, the role used to give the grant the privileges. I think I'll recreateyour_schema.your_tablefrom scratch. Perhaps it is a bug in 9.2 and we're in the process of upgrading now. – Dylan Hettinger Jun 11 '18 at 20:52