2
0
mirror of https://github.com/chubin/cheat.sheets synced 2024-11-01 21:40:24 +00:00
cheat.sheets/sheets/_psql/permissions

21 lines
718 B
Plaintext
Raw Normal View History

2018-01-17 16:13:38 +00:00
-- Grant all permissions on database
2018-01-07 11:42:08 +00:00
GRANT ALL PRIVILEGES ON DATABASE <db_name> TO <user_name>;
2018-01-17 16:13:38 +00:00
-- Grant connection permissions on database
2018-01-07 11:42:08 +00:00
GRANT CONNECT ON DATABASE <db_name> TO <user_name>;
2018-01-17 16:13:38 +00:00
-- Grant permissions on schema
2018-01-07 11:42:08 +00:00
GRANT USAGE ON SCHEMA public TO <user_name>;
2018-01-17 16:13:38 +00:00
-- Grant permissions to functions
2018-01-07 11:42:08 +00:00
GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA public TO <user_name>;
2018-01-17 16:13:38 +00:00
-- Grant permissions to select, update, insert, delete, on a all tables
2018-01-07 11:42:08 +00:00
GRANT SELECT, UPDATE, INSERT ON ALL TABLES IN SCHEMA public TO <user_name>;
2018-01-17 16:13:38 +00:00
-- Grant permissions, on a table
2018-01-07 11:42:08 +00:00
GRANT SELECT, UPDATE, INSERT ON <table_name> TO <user_name>;
2018-01-17 16:13:38 +00:00
-- Grant permissions, to select, on a table
2018-01-07 11:42:08 +00:00
GRANT SELECT ON ALL TABLES IN SCHEMA public TO <user_name>;