Last active
October 22, 2025 01:44
-
-
Save craigs/42ea907a068f5d3399ee7d9581a2e094 to your computer and use it in GitHub Desktop.
Drop all tables in a Postgres database
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
| -- This script will generate drop statements for | |
| -- all tables in a Postgres database | |
| select 'drop table if exists "' || tablename || '" cascade;' as "statement" | |
| from pg_tables | |
| where schemaname = 'public' | |
| order by "statement"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment