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 1puUyS-0001k7-VL for pgsql-admin@arkaria.postgresql.org; Thu, 04 May 2023 09:10:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1puUxS-0001hH-IE for pgsql-admin@arkaria.postgresql.org; Thu, 04 May 2023 09:09:02 +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 1puUxS-0001h8-80 for pgsql-admin@lists.postgresql.org; Thu, 04 May 2023 09:09:02 +0000 Received: from mout-u-107.mailbox.org ([2001:67c:2050:101:465::107]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1puUxN-000SO2-Hv for pgsql-admin@lists.postgresql.org; Thu, 04 May 2023 09:09:01 +0000 Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-107.mailbox.org (Postfix) with ESMTPS id 4QBp023Ylmz9sb6; Thu, 4 May 2023 11:08:50 +0200 (CEST) Date: Thu, 4 May 2023 11:08:50 +0200 (CEST) From: Erik Wienhold To: M Sarwar , "pgsql-admin@lists.postgresql.org" Message-ID: <1679699150.1638077.1683191330069@office.mailbox.org> In-Reply-To: References: Subject: Re: Just View create privilege to user user2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Priority: 3 Importance: Normal X-Rspamd-Queue-Id: 4QBp023Ylmz9sb6 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 04/05/2023 01:07 CEST M Sarwar wrote: > > I want user u2 to have only CREATE VIEW privilege in schema s2. I do not want > u2 to create any other type of objects in s2 schema. You can setup a second database db2 just for u2 and have them access your database db1 via foreign tables. u2 still only has the SELECT privilege in db1 but can create objects in db2 and mess it up as they see fit. If you go with a single database and event triggers as Tom wrote you must also consider function security[0]. Otherwise u2 can override relations in s1 just by creating compatible views in s2 and set search_path=s2,s1. u2 can thus inject data into functions that have no explicit search_path. [0] https://www.postgresql.org/docs/current/perm-functions.html -- Erik