Re: BUG #16911: "permission denied" error deleting rows as superuser from a table owned by a non-superuser

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pg(dot)org(at)realityexists(dot)net
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16911: "permission denied" error deleting rows as superuser from a table owned by a non-superuser
Date: 2021-03-03 19:04:53
Message-ID: 1205670.1614798293@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> CREATE TABLE myschema.fktable (customer_id int REFERENCES
> myschema.pktable(id));
> INSERT INTO myschema.pktable VALUES (1);
> DELETE FROM myschema.pktable;

> Expected result: no errors; the row is successfully deleted from
> myschema.pktable.
> Actual result: the final DELETE fails with
> ERROR: permission denied for schema myschema

This is operating as designed: the foreign key enforcement triggers
run as the table owner, not as the calling user. Changing that would
not be a good idea.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2021-03-03 19:11:47 Re: BUG #16911: "permission denied" error deleting rows as superuser from a table owned by a non-superuser
Previous Message PG Bug reporting form 2021-03-03 17:51:46 BUG #16911: "permission denied" error deleting rows as superuser from a table owned by a non-superuser