Last active
January 4, 2016 12:49
-
-
Save nounderline/8623848 to your computer and use it in GitHub Desktop.
[Postgres] Manage roles
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
---------------------------------- | |
-- Managing roles in PostgreSQL -- | |
---------------------------------- | |
-- Create -- | |
CREATE ROLE name WITH PASSWORD 'd94jsfsd' LOGIN; | |
-- Grant privileges to database -- | |
GRANT ALL PRIVILEGES ON DATABASE database_name TO name; | |
-- Grant privileges to table -- | |
GRANT ALL PRIVILEGES ON TABLE users TO name; | |
-- Revoke privileges -- | |
DROP OWNED BY name; | |
-- Modify -- | |
ALTER ROLE name WITH login; | |
-- Delete -- | |
DROP ROLE name; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment