Forked from balazs-endresz/gist:f9b27514046506a7db75
Created
September 3, 2017 21:40
-
-
Save medyo/fad03c9c4173e7c84f1ffae0d06f9af8 to your computer and use it in GitHub Desktop.
Drop all tables and sequences in postgres
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
# tables for owned by 'tableowner' | |
select 'drop table if exists "' || tablename || '" cascade;' from pg_tables where tableowner='tableowner'; | |
# all sequences | |
select 'drop sequence if exists "' || relname || '" cascade;' from pg_class where relkind = 'S'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment