Last active
November 21, 2018 09:06
-
-
Save jerinisready/ff754db6ce33511c5010fc52677c5146 to your computer and use it in GitHub Desktop.
Postgresql Quick Refer Collection. [Generate SQL's For Altering Ownership for all table] [psql: FATAL: role "user" is not permitted to log in]
This file contains hidden or 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
| # Generate SQLs For Altering Ownership for all table | |
| SELECT 'ALTER TABLE '|| schemaname || '.' || tablename ||' OWNER TO ipc_user;' | |
| FROM pg_tables WHERE NOT schemaname IN ('pg_catalog', 'information_schema') | |
| ORDER BY schemaname, tablename; | |
| # TO PERMIT LOGIN | |
| # issue : 'psql: FATAL: role "user" is not permitted to log in' | |
| CREATE ROLE "user" WITH PASSWORD 'password'; | |
| DROP DATABASE IF EXISTS "testdb"; CREATE DATABASE "testdb" OWNER "user"; | |
| # GRANT ALL ON DATABASE "testdb" TO "user"; ## !OWNERSHIP DO THE SAME | |
| ALTER ROLE "user" WITH LOGIN; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment