Howto: drop Postgres tables matching a pattern
Suppose that your database has lots of tables, with similar names (maybe partitions of a bigger table?), here's a quick way to drop them in bulk
SELECT 'drop table '||n.nspname ||'.'|| c.relname||';' as "Name"
FROM pg_catalog.pg_class c
LEFT JO...
fragland.dev1 min read