PostgreSQL – elimine todas as tabelas do banco de dados atual

DO $$
DECLARE

tbl pg_tables
%ROWTYPE;
BEGIN
FOR tbl IN SELECT
* FROM pg_tables
WHERE schemaname
= 'public'
LOOP

EXECUTE
'DROP TABLE ' || tbl.tablename || ' CASCADE;';
END LOOP;
END$$