Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save anilktechie/6458db4a72841a20310afb09a2201fc5 to your computer and use it in GitHub Desktop.

Select an option

Save anilktechie/6458db4a72841a20310afb09a2201fc5 to your computer and use it in GitHub Desktop.
DO $$
DECLARE r RECORD;
BEGIN
FOR r IN
(SELECT tablename FROM pg_tables WHERE schemaname = current_schema())
LOOP
EXECUTE 'DROP TABLE IF EXISTS ' || quote_ident(r.tablename) || ' CASCADE';
END LOOP;
END $$ ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment