Question #84

Author: admin
tags: PostgreSQL  
DROP DATABASE somedb WITH (FORCE);
What does the WITH (FORCE) option do in this query?
Allows to remove a database, even if it has any tables
Allows to remove a database, if it has tables, but they are all empty
Allows to remove a database, even it has existing connections, by terminating them
Allows to remove a database, even if the user does not have the appropriate permissions
FORCE option - attempt to terminate all existing connections to the target database.
It doesn't terminate if prepared transactions, active logical replication slots or subscriptions are present in the target database.
This will fail if the current user has no permissions to terminate other connections.
The option is available starting from PostgreSQL 13.
Rate the difficulty of the question:
easyhard