When working with partitions, there is often a need to delete all partitions at once.
However
DROP TABLE tablename*
Does not work.
Here's another hackish answer to this problem. It works in ubuntu
and maybe some other os too. do a \dt
in postgres command prompt(the command prompt was running inside genome-terminal
in my case). Then you'll see a lot of tables in the terminal. Now use ctrl+click-drag
functionality of the genome-terminal
to copy all tables' names. Open python, do some string processing(replace ' ' by '' and then '\n' by ',') and you get comma separated list of all tables. Now in psql shell do a
drop table CTRL+SHIFT+V
and you're done. I know it's too specific I just wanted to share. :)