2
0
mirror of https://github.com/chubin/cheat.sheets synced 2024-11-15 06:12:59 +00:00
cheat.sheets/sheets/_psql/permissions
2018-01-17 16:13:38 +00:00

21 lines
718 B
Plaintext

-- Grant all permissions on database
GRANT ALL PRIVILEGES ON DATABASE <db_name> TO <user_name>;
-- Grant connection permissions on database
GRANT CONNECT ON DATABASE <db_name> TO <user_name>;
-- Grant permissions on schema
GRANT USAGE ON SCHEMA public TO <user_name>;
-- Grant permissions to functions
GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA public TO <user_name>;
-- Grant permissions to select, update, insert, delete, on a all tables
GRANT SELECT, UPDATE, INSERT ON ALL TABLES IN SCHEMA public TO <user_name>;
-- Grant permissions, on a table
GRANT SELECT, UPDATE, INSERT ON <table_name> TO <user_name>;
-- Grant permissions, to select, on a table
GRANT SELECT ON ALL TABLES IN SCHEMA public TO <user_name>;