Re: Grant CREATE privilege on all schemas

From: ivanov17(at)riseup(dot)net
To: Pgsql Novice <pgsql-novice(at)lists(dot)postgresql(dot)org>
Subject: Re: Grant CREATE privilege on all schemas
Date: 2023-09-12 17:38:18
Message-ID: 42a7db124fa2f9685f01c0a80161549c@riseup.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

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

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Laurenz Albe 2023-09-12 17:59:03 Re: Grant CREATE privilege on all schemas
Previous Message Laurenz Albe 2023-09-12 12:48:02 Re: Even if I have a lot of free space PgSQL returns "ERROR: could not extend file - No space left on device"