Created
May 26, 2014 11:48
-
-
Save dbalan/2fa6e07af8a07561eafb to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
# change table owners for a databse - postgresql | |
ALTER DATABSE dbname OWNER TO username; | |
for tbl in $(psql -qAt -c "SELECT TABLENAME FROM pg_tables WHERE schemaname = 'public';" $DATABASE); | |
do | |
psql -c "alter table $tbl owner to $NEW_OWNER" $DATABASE ; done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment