Question on table inheritance and privileges

From: 윤기태 <gtyun(at)bitnine(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Question on table inheritance and privileges
Date: 2016-08-03 04:35:24
Message-ID: CA+CzYHaOxbC-PmAqxLKzk_9zM7Rznqy-+4BQxq_NsdeE_YubBw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dear pgsql-general,

I found something strange with DROP TABLE CASCADE.

create role a login;
grant all on database mydb to a;

create role b inherit role a login;
grant all on database mydb to b;

(session of role a)
psql -U a -d mydb;
create schema a;
create table a(i1 int);

(session of role b)
psql -U b -d mydb;
create schema b;
create table b(c1 char);

(session of role a)
create table c() inherits(a.a, b.b);

(session of role b)
drop table a.c;
-->> ERROR: permission denied for schema a
drop table b cascade
NOTICE: drop cascades to table a.c
DROP TABLE

Is it normal?
role b is not owner of table c but role b can drop it with cascade.
If I 'grant all on schema a to b', role b still cannot drop table c.
Because role b is not owner of table c.

Sorry for poor English.

Thanks.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Moreno Andreo 2016-08-03 11:07:19 Re: [SPAM] Re: [SPAM] Re: WAL directory size calculation
Previous Message Venkata Balaji N 2016-08-03 03:53:28 Re: How to best archetect Multi-Tenant SaaS application using Postgres