- YugabyteDB - All versions
When trying to drop the database, the command fails with the error:
ERROR: database "test" is being accessed by other users
DETAIL: There are 9 other sessions using the database.
Checking the pg_stat activity can confirm if there are sessions holding the database. This can be verified by using the below query:
select * from pg_stat_activity where datname ='test';
If the above query returns 0 records, that confirms there are no active sessions using the database. However, due to an internal bug, it's possible to hit the aforementioned error even though there are no active sessions holding the database. The mitigation until the bug gets fixed would be to restart the t-server process and re-attempt the drop command operation.