Skip to content
Advertisement

How to drop multiple tables in PostgreSQL using a wildcard

When working with partitions, there is often a need to delete all partitions at once.

However

Does not work. (The wildcard is not respected).

Is there an elegant (read: easy to remember) way to drop multiple tables in one command with a wildcard?

Advertisement

Answer

Use a comma separated list:

If you realy need a footgun, this one will do it’s job:

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement