Ensure that the user should be able to drop the database even if it is connected. Fixes #5722

This commit is contained in:
Pradip Parkale 2020-08-25 12:37:50 +05:30 committed by Akshay Joshi
parent b3d49c61a5
commit 86bbc3a9e8
2 changed files with 12 additions and 0 deletions

View File

@ -19,5 +19,6 @@ Housekeeping
Bug fixes
*********
| `Issue #5722 <https://redmine.postgresql.org/issues/5722>`_ - Ensure that the user should be able to drop the database even if it is connected.
| `Issue #5748 <https://redmine.postgresql.org/issues/5748>`_ - Fixed incorrect reverse engineering SQL for Foreign key when creating a table.
| `Issue #5754 <https://redmine.postgresql.org/issues/5754>`_ - Fixed an issue where schema diff is not working when providing the options to Foreign Data Wrapper, Foreign Server, and User Mapping.

View File

@ -872,6 +872,17 @@ class DatabaseView(PGChildNodeView):
)
)
else:
if self.conn.connected():
# Release the connection if it is connected
from pgadmin.utils.driver import get_driver
manager = \
get_driver(PG_DEFAULT_DRIVER).connection_manager(sid)
manager.connection(did=did, auto_reconnect=True)
status = manager.release(did=did)
if not status:
return unauthorized(
_("Database could not be deleted."))
SQL = render_template(
"/".join([self.template_path, self._DELETE_SQL]),