Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gN1gz-0004xd-MZ for pgsql-general@arkaria.postgresql.org; Wed, 14 Nov 2018 20:23:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gN1gx-00018T-Fo for pgsql-general@arkaria.postgresql.org; Wed, 14 Nov 2018 20:23:15 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gN1gw-00018L-Or for pgsql-general@lists.postgresql.org; Wed, 14 Nov 2018 20:23:15 +0000 Received: from mx1.riseup.net ([198.252.153.129]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gN1go-0001rd-HM for pgsql-general@lists.postgresql.org; Wed, 14 Nov 2018 20:23:13 +0000 Received: from piha.riseup.net (piha-pn.riseup.net [10.0.1.163]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client CN "*.riseup.net", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.riseup.net (Postfix) with ESMTPS id 0FEF31A0A6B for ; Wed, 14 Nov 2018 12:23:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1542226983; bh=kuXF4gXKeYCt1kWa2ZZrDMSaOQn23ZIC2McXgJuxrso=; h=Date:From:To:Subject:References:In-Reply-To:From; b=JCv8+F3muX/X5u2u/zbi+pP4fA/Urh/P4UOh9ymBAXn4H/0RSi5V+JYan3SwQrsze 86ltsOxVdjuON4ERQG0+o+UnsODBXm+ZRpL7xHdNe4yZaB5awWru/0Lc95UqLzmgOZ izE3+q++SJGNo71D4yWgYgK+5fkOm9dW68OJNB8A= X-Riseup-User-ID: 81BD6742D478126FD941617AB91F4F1025C6830061259BCD332D973A7A580251 Received: from [127.0.0.1] (localhost [127.0.0.1]) by piha.riseup.net with ESMTPSA id 44DF766A8D for ; Wed, 14 Nov 2018 12:23:02 -0800 (PST) Date: Wed, 14 Nov 2018 21:23:00 +0100 From: Nicolas Paris To: pgsql-general@lists.postgresql.org Subject: Re: Default Privilege Table ANY ROLE Message-ID: <20181114202055.a23bgy354qnmo7jn@riseup.net> Mail-Followup-To: pgsql-general@lists.postgresql.org References: <20181114141608.ryvolxl7v7z2grzi@riseup.net> <306e4be880a264c701be5dfa667a1e95de76e175.camel@cybertec.at> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <306e4be880a264c701be5dfa667a1e95de76e175.camel@cybertec.at> Priority: normal List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Wed, Nov 14, 2018 at 09:04:44PM +0100, Laurenz Albe wrote: > Nicolas Paris wrote: > > I d'like my user be able to select on any new table from other users. > > > > > ALTER DEFAULT PRIVILEGES FOR ROLE "theowner1" IN SCHEMA "myschema" GRANT select ON TABLES TO "myuser" > > > ALTER DEFAULT PRIVILEGES FOR ROLE "theowner2" IN SCHEMA "myschema" GRANT select ON TABLES TO "myuser" > > > ... > > > > > > Do I really have to repeat the command for all users ? > > > > The problem is I have many user able to create tables and all of them > > have to read each other. > > Now whenever "alice" has to create a table, she runs > SET ROLE tableowner; > Then all these tables belong to "tableowner", and each user in group "tablereader" > can SELECT from them: Yes, this step is overhead to me: > SET ROLE tableowner; In my mind, both bob/alice inherit from the same group, so they should share the table they build according to this: > ALTER DEFAULT PRIVILEGES FOR ROLE tableowner IN SCHEMA myschema GRANT SELECT ON TABLES TO tablereader; -- nicolas