Skip to content

Instantly share code, notes, and snippets.

@evilkost
Created August 16, 2018 13:50
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 evilkost/4344703938a0b194e06ac9cd34c912e8 to your computer and use it in GitHub Desktop.
Save evilkost/4344703938a0b194e06ac9cd34c912e8 to your computer and use it in GitHub Desktop.
DO $$ DECLARE
tabname RECORD;
BEGIN
FOR tabname IN (SELECT tablename
FROM pg_tables
WHERE schemaname = current_schema())
LOOP
EXECUTE 'DROP TABLE IF EXISTS ' || quote_ident(tabname.tablename) || ' CASCADE';
END LOOP;
END $$;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment