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 1lJIGw-0002e1-8j for pgsql-admin@arkaria.postgresql.org; Mon, 08 Mar 2021 15:58:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lJIGv-0006RW-7Z for pgsql-admin@arkaria.postgresql.org; Mon, 08 Mar 2021 15:58:17 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lJIGv-0006RP-0T for pgsql-admin@lists.postgresql.org; Mon, 08 Mar 2021 15:58:17 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lJIGs-0006wE-Us for pgsql-admin@lists.postgresql.org; Mon, 08 Mar 2021 15:58:16 +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 128FwCA11741404; Mon, 8 Mar 2021 10:58:12 -0500 From: Tom Lane To: Peter Wainaina cc: pgsql-admin@lists.postgresql.org Subject: Re: RESTRICT TABLE OWNER NOT TO DELETE IT In-reply-to: References: Comments: In-reply-to Peter Wainaina message dated "Mon, 08 Mar 2021 14:23:43 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1741402.1615219092.1@sss.pgh.pa.us> Date: Mon, 08 Mar 2021 10:58:12 -0500 Message-ID: <1741403.1615219092@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Peter Wainaina writes: > i need help on how to restrict the table owner no to drop/truncate the table As far as Postgres is concerned, "can drop the object" is pretty much the definition of ownership. Maybe you need to rethink who owns which tables in your design. (Yes, you could use event triggers to interfere with the normal system behavior, but that doesn't make it a good idea.) The owner can revoke her own TRUNCATE privilege, but that's just a mistake preventer, since she can also re-grant the privilege to herself. regards, tom lane