Guest User

Untitled

a guest
Nov 13th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. DO $$
  2. DECLARE
  3. r record;
  4. BEGIN
  5. FOR r IN SELECT quote_ident(tablename) AS tablename, quote_ident(schemaname) AS schemaname FROM pg_tables WHERE schemaname = 'public'
  6. LOOP
  7. RAISE INFO 'Dropping table %.%', r.schemaname, r.tablename;
  8. EXECUTE format('DROP TABLE IF EXISTS %I.%I CASCADE', r.schemaname, r.tablename);
  9. END LOOP;
  10. END$$;
Add Comment
Please, Sign In to add comment