Drop multiple databases in one script
-
30-10-2019 - |
Вопрос
I am trying to figure out how to drop multiple databases on PostgreSQL in one sql script. I preferably need it to work both when executed in pgAdmin
console, and when used in psql
command line tool. When I do:
DROP DATABASE db1;
DROP DATABASE db2;
I get following error:
DROP DATABASE cannot be executed from a function or multi-command string
Is there any way around this problem? I.e., is there any way to run each command separately (like when using "GO" statement on MSSQL), or some other sensible way to easily drop multiple databases? I need this functionality for maintenance scripts during development.
Нет правильного решения
Не связан с dba.stackexchange