Last active
June 8, 2018 19:36
-
-
Save thm1118/9320610 to your computer and use it in GitHub Desktop.
bulk alter role of postgreSQL's database or table or view .etc
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
REASSIGN OWNED BY old_role [, ...] TO new_role |
👍
You can't use this if:
- your db owned by postgres
- you want to change onwer for one db only.
But It's very helpful to replace one user by another for whole db.
If your are applying it to multiple database which has multiple schemas with multiple objects, where all the named could have different owners :/
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
more complex shell script + sql :
https://gist.github.com/gingerlime/2482969