Skip to content

Instantly share code, notes, and snippets.

@philipstanislaus
Created August 4, 2017 07:47
Show Gist options
  • Save philipstanislaus/8006abb547dbfdcfe361f0288de4c8c9 to your computer and use it in GitHub Desktop.
Save philipstanislaus/8006abb547dbfdcfe361f0288de4c8c9 to your computer and use it in GitHub Desktop.
Drop all tables from one schema in Postgres
select 'drop table if exists "' || tablename || '" cascade;'
from pg_tables
where schemaname = 'public'; -- or any other schema
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment