Skip to content

Instantly share code, notes, and snippets.

@balazs-endresz
balazs-endresz / gist:f9b27514046506a7db75
Created December 2, 2014 09:34
Drop all tables and sequences in postgres
# 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';