Re: SQL command : ALTER DATABASE OWNER TO

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: SQL command : ALTER DATABASE OWNER TO
Дата
Msg-id CAKFQuwbjczTu0H2Jcxkt=SnCx73Crgos0vDpd12KEBxM-Rrh3w@mail.gmail.com
обсуждение исходный текст
Ответ на Re: SQL command : ALTER DATABASE OWNER TO  (gparc@free.fr)
Ответы Re: SQL command : ALTER DATABASE OWNER TO  (gparc@free.fr)
Список pgsql-docs
On Wed, Jan 24, 2024 at 9:23 AM <gparc@free.fr> wrote:-
[postgres] $ psql
psql (14.10)


You really should add commentary, especially since you never demonstrated the tst role (I advise picking different names for all of the objects in the future) being unable to login.  Which they should be able to since public is shown to have "c" connect privileges (=Tc/tst)

 
[postgres@PGDEV14] postgres=# create user tst password 'tst';
CREATE ROLE
[postgres@PGDEV14] postgres=# create database tst owner = tst;
CREATE DATABASE

This next command is pointless, it is a no-op, as soon as you made them owner of the tst database they already had all privileges to it, granted by the same user that created the database.  And only it, that command is not recursing through the database into schemas and tables and adding more permissions.  That isn't how this all works, a database is an object.  While it is also a concept that encompasses the entire schema within it the permissions system only cares about the first definition.

[postgres@PGDEV14] postgres=# grant all on database tst to tst;
GRANT
[postgres@PGDEV14] postgres=# \l+ tst
                                              Liste des bases de données
 Nom | Propriétaire | Encodage | Collationnement | Type caract. | Droits d'accès | Taille  | Tablespace | Description
-----+--------------+----------+-----------------+--------------+----------------+---------+------------+-------------
 tst | tst          | UTF8     | fr_FR.UTF-8     | fr_FR.UTF-8  | =Tc/tst       +| 9809 kB | pg_default |
     |              |          |                 |              | tst=CTc/tst    |         |            |
(1 ligne)


What are you trying to demonstrate here?


[postgres@PGDEV14] tst=# \dn+ tst
                 Liste des schémas
 Nom | Propriétaire | Droits d'accès | Description
-----+--------------+----------------+-------------
 tst | tst          |                |
(1 ligne)


David J.

В списке pgsql-docs по дате отправления:

Предыдущее
От: gparc@free.fr
Дата:
Сообщение: Re: SQL command : ALTER DATABASE OWNER TO
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: SQL command : ALTER DATABASE OWNER TO