Skip to content

Instantly share code, notes, and snippets.

@stevehenderson
Last active August 21, 2022 03:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevehenderson/35372794c838572e634a71790f05d515 to your computer and use it in GitHub Desktop.
Save stevehenderson/35372794c838572e634a71790f05d515 to your computer and use it in GitHub Desktop.
Cascade drop all tables in a SQL/PostgreSQL schema
-- You will need to remove some quotation marks
select 'drop table if exists "schema_name"."' || tablename || '" cascade;'
from pg_tables
where schemaname = 'schema_name';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment