2
0
mirror of https://github.com/chubin/cheat.sheets synced 2024-11-19 03:25:44 +00:00
cheat.sheets/sheets/_psql/roles
2018-01-17 16:13:38 +00:00

12 lines
291 B
Plaintext

-- Create a new role
CREATE ROLE role_name;
-- Create a new role with a username and password:
CREATE ROLE username NOINHERIT LOGIN PASSWORD password;
-- Change role for current sesion to the new_role:
SET ROLE new_role;
-- Allow role_1 to set its role as role_2:
GRANT role_2 TO role_1;