Created
September 2, 2022 13:19
-
-
Save mator/f3af982c45395e2453e149f23c78f8b4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
read-only доступ для пользователя readonly до базы db1 для PostgreSQL версии меньше чем 14.x: | |
\c db1 | |
CREATE USER readonly WITH PASSWORD 'xxx'; | |
GRANT CONNECT ON DATABASE db1 TO readonly; | |
GRANT USAGE ON SCHEMA public TO readonly; | |
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readonly; | |
с версии 14.x появилась возможность использовать predefined role "pg_read_all_data" (заменяющая последние две команды SQL: USAGE/SELECT) : | |
GRANT pg_read_all_data TO userA; | |
PS: так же, в 14-й версии появилась роль pg_write_all_data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment