Created
July 30, 2013 22:06
-
-
Save tonatiuh/6117475 to your computer and use it in GitHub Desktop.
Reset db on psql
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
SELECT | |
'DROP TABLE '||c.relname ||' CASCADE;' | |
FROM pg_catalog.pg_class c | |
JOIN pg_catalog.pg_roles r ON r.oid = c.relowner | |
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace | |
WHERE c.relkind IN ('r','') | |
AND n.nspname NOT IN ('pg_catalog', 'pg_toast') | |
AND pg_catalog.pg_table_is_visible(c.oid) | |
ORDER BY 1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment