SELECT STRING_AGG('drop table if exists ' || tablename || ' cascade;', E'\\\\n' ORDER BY tablename)
FROM pg_tables
WHERE tablename !~ '(spatial|pg|sql)_.+'
;
SELECT STRING_AGG('drop procedure if exists ' || proname || ';', E'\\\\n')
FROM pg_proc
WHERE prokind = 'p'
;