`DROP DATABASE` is a very special command that cannot be undone. To my knowledge there is no way to drop a database inside a transaction. I quote the [manual][1]: > DROP DATABASE cannot be executed inside a transaction block. Whenever you run two commands in a script in ***pgAdmin***, they are automatically wrapped into a transaction. You can explicitly begin and commit transactions, but you cannot send multiple commands at once in one session and "outside" of a transaction. Similar in ***psql*** when called with `-c command`, [per documentation][2]: > If the command string contains multiple SQL commands, they are > processed in a single transaction, unless there are explicit > `BEGIN`/`COMMIT` commands included in the string to divide it into > multiple transactions. **However**, when fed to ***psql*** via standard input: > This is different from the behavior when the > same string is fed to psql's standard input [...] > [...] either using echo as illustrated above, or via a shell here-document, for example: > > psql <<EOF > \x > SELECT * FROM foo; > EOF So you can use psql with standard input in default [*autocommit-on* mode][3]. Else, you can only run this as a **separate command** or wrapped into a `BEGIN`/`COMMIT` block separately. You could use the program [`dropdb`][4] from the shell - or write a shell-script with it that drops multiple database in succession. BTW, the only difference between what you can run from pgAdmin and from `psql` are the [meta-comnmands of psql][5] - which are not SQL. Those are interpreted by psql and not sent to the database engine. You cannot mix meta-commands and SQL. (Well, there are tricks with the the separator meta-command `\\`, there is an [example in the manual][6] ...) [1]: http://www.postgresql.org/docs/current/interactive/sql-dropdatabase.html [2]: http://www.postgresql.org/docs/current/interactive/app-psql.html [3]: http://APP-PSQL-VARIABLES [4]: http://www.postgresql.org/docs/current/interactive/app-dropdb.html [5]: http://www.postgresql.org/docs/current/interactive/app-psql.html#APP-PSQL-META-COMMANDS [6]: http://www.postgresql.org/docs/current/interactive/app-psql.html