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 1mD5bP-0002at-L1 for pgsql-sql@arkaria.postgresql.org; Mon, 09 Aug 2021 13:46:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mD5bO-0008Ky-FI for pgsql-sql@arkaria.postgresql.org; Mon, 09 Aug 2021 13:46:02 +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 1mD5bO-0008Kq-8C for pgsql-sql@lists.postgresql.org; Mon, 09 Aug 2021 13:46:02 +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 1mD5bM-0008QO-2Q for pgsql-sql@lists.postgresql.org; Mon, 09 Aug 2021 13:46:01 +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 179DjvBt3360704; Mon, 9 Aug 2021 09:45:57 -0400 From: Tom Lane To: Jayadevan M cc: intmail01@gmail.com, pgsql-sql@lists.postgresql.org Subject: Re: Hide some tables In-reply-to: References: <2a4f55f7-b8fb-4937-9136-c7e35de63f79@gmail.com> Comments: In-reply-to Jayadevan M message dated "Mon, 09 Aug 2021 19:09:47 +0530" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3360702.1628516757.1@sss.pgh.pa.us> Date: Mon, 09 Aug 2021 09:45:57 -0400 Message-ID: <3360703.1628516757@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Jayadevan M writes: > There are some operators who enters data in my database with just one >> table. Others tables are updated by triggers, these tables contains >> result of calculation. How to do to hide these tables because I do not >> want that operators read them ? On help documentation it is said that I >> can not block SELECT privilege because it is required for UPDATE. >> > Can you move them to a different schema, and manage using search_path? The thing to use is privileges. Make the tables-that-should-be-hidden owned by a different SQL role, and don't give select privilege on them to the data entry role. The triggers can be (or call) SECURITY DEFINER functions owned by the first role, giving them access that the data entry role does not have. regards, tom lane