Created
October 18, 2016 19:44
-
-
Save 00krishna/c163f5675dfb06fa74dc20fceb16d4fa to your computer and use it in GitHub Desktop.
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
-- lower case table names -- the psql friendly and more reader-friendly way | |
SELECT 'ALTER TABLE ' || quote_ident(t.table_schema) || '.' | |
|| quote_ident(t.table_name) || ' RENAME TO ' || quote_ident(lower(t.table_name)) || ';' As ddlsql | |
FROM information_schema.tables As t | |
WHERE t.table_schema NOT IN('information_schema', 'pg_catalog') | |
AND t.table_name <> lower(t.table_name) | |
ORDER BY t.table_schema, t.table_name; | |
--generates something like this | |
--ALTER TABLE public."SPRINT" RENAME TO sprint; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment