When debugging programs, I need to frequently drop a database of Postgresql, and then re-create it again.
To convenient, I want to execute this in a single command line like following:
psql -c "DROP DATABASE my_db; CREATE DATABASE my_db;"
But I get a error:
ERROR: DROP DATABASE cannot run inside a transaction block
Is there a way I can do it? Thanks!