Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qg7Mw-00EVNw-N1 for pgsql-novice@arkaria.postgresql.org; Tue, 12 Sep 2023 17:40:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qg7Mv-009uge-5j for pgsql-novice@arkaria.postgresql.org; Tue, 12 Sep 2023 17:40:08 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qg7Mu-009ug9-Ct for pgsql-novice@lists.postgresql.org; Tue, 12 Sep 2023 17:40:08 +0000 Received: from mx1.riseup.net ([198.252.153.129]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qg7Mp-004BeX-MC for pgsql-novice@lists.postgresql.org; Tue, 12 Sep 2023 17:40:06 +0000 Received: from fews02-sea.riseup.net (fews02-sea-pn.riseup.net [10.0.1.112]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx1.riseup.net (Postfix) with ESMTPS id 4RlW5R44M9zDqp5 for ; Tue, 12 Sep 2023 17:38:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1694540299; bh=wVRHUvEHMmuiUZECdMEn4W5OD5UHRM8+Rlx3F2m1/f4=; h=Date:From:To:Subject:In-Reply-To:References:From; b=dmX6uZjAh9nUG2VB53zZ4Fy//iVsqVdlRkvghlUgPSZJdhXGSnjI17M4X80VRJTNQ 44/wgyuBy5jzgxhrbqvAUk3yIrMMWmAdx5zZc03ldYLll6IxQXKO2Q6hHCMAbfe3aT SvLr+SvYlAEiOPxUf9n06Adrs8nSH+9BZg7dEah8= X-Riseup-User-ID: FB13C694F8B81BABCA69DBE5F3C5F1C692FC0FBFC9D4E67B013D9BE534BDB072 Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews02-sea.riseup.net (Postfix) with ESMTPSA id 4RlW5R2lS7zFpfQ for ; Tue, 12 Sep 2023 17:38:19 +0000 (UTC) MIME-Version: 1.0 Date: Tue, 12 Sep 2023 17:38:18 +0000 From: ivanov17@riseup.net To: Pgsql Novice Subject: Re: Grant CREATE privilege on all schemas In-Reply-To: References: Message-ID: <42a7db124fa2f9685f01c0a80161549c@riseup.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk David G. Johnston писал(а) 2023-09-12 05:42: > > There are default privileges that can be setup so that when new > objects are created existing roles are given the described grants at > that time. > > https://www.postgresql.org/docs/current/sql-alterdefaultprivileges.html > > Note the absence of DATABASE as an object type on that page. Thank you for your answer. Unfortunately, I'm not even a junior DBA, so I might be misunderstanding something. Сan I ask more questions? Typically, for each of my websites, I create one database, one database owner role, and its private schema. And I want to have a role that can to access each private schema to create tables and write data to provide database migrations. I can't know what schema I need to create tomorrow, so I think it's reasonable to grant privileges to the migration role in advance. But maybe I don't need predefined roles at all. Now I see that I might to have another problem because tables should be created by migration role, but after that they must be fully accessible to the database owner. I think I also need to grant full default privileges to the database/schema owners on all tables created by the migration role in their own schemas, right? Also, when creating databases/schemas, I need to give the migration role full default privileges to use private schemas, create tables in them, and write data. In this case, I no longer need the predefined roles. Does this sound like a good plan? Could you please correct me if there is a better way to do this? > There really isn't such a thing as "feature request" here - there > isn't anyone that really makes it a point to fulfill such requests and > there is more than manageable work in process already. That said, > discussion about what PostgreSQL can and cannot do, sent to the > -general list, do get read by many including developers. Thank you. I thought that I missed something. -- With appreciation, Ivanov