Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lHWnq-0006mv-SW for pgsql-bugs@arkaria.postgresql.org; Wed, 03 Mar 2021 19:04:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lHWnp-00071K-Fx for pgsql-bugs@arkaria.postgresql.org; Wed, 03 Mar 2021 19:04:57 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lHWnp-00071C-9v for pgsql-bugs@lists.postgresql.org; Wed, 03 Mar 2021 19:04:57 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lHWnn-0001S7-AB for pgsql-bugs@lists.postgresql.org; Wed, 03 Mar 2021 19:04:56 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 123J4r1m1205671; Wed, 3 Mar 2021 14:04:53 -0500 From: Tom Lane To: pg.org@realityexists.net cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16911: "permission denied" error deleting rows as superuser from a table owned by a non-superuser In-reply-to: <16911-ca792f6bbe244754@postgresql.org> References: <16911-ca792f6bbe244754@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Wed, 03 Mar 2021 17:51:46 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1205669.1614798293.1@sss.pgh.pa.us> Date: Wed, 03 Mar 2021 14:04:53 -0500 Message-ID: <1205670.1614798293@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form 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