mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Handle errors properly if they occur when renaming a database. Fixes #3353
This commit is contained in:
parent
9f13865777
commit
08990cb1de
@ -32,3 +32,4 @@ Bug fixes
|
||||
| `Bug #3324 <https://redmine.postgresql.org/issues/3324>`_ - Fix the template loader to work reliably under Windows (fixing external tables under Greenplum)
|
||||
| `Bug #3333 <https://redmine.postgresql.org/issues/3333>`_ - Ensure the runtime core application is setup before trying to access any settings
|
||||
| `Bug #3342 <https://redmine.postgresql.org/issues/3342>`_ - Set SESSION_COOKIE_SAMESITE='Lax' per Flask recommendation to prevents sending cookies with CSRF-prone requests from external sites, such as submitting a form
|
||||
| `Bug #3353 <https://redmine.postgresql.org/issues/3353>`_ - Handle errors properly if they occur when renaming a database
|
@ -634,6 +634,17 @@ class DatabaseView(PGChildNodeView):
|
||||
if SQL and SQL != "":
|
||||
status, msg = conn.execute_scalar(SQL)
|
||||
if not status:
|
||||
# In case of error from server while rename it,
|
||||
# reconnect to the database with old name again.
|
||||
self.conn = self.manager.connection(
|
||||
database=data['old_name'], auto_reconnect=True
|
||||
)
|
||||
status, errmsg = self.conn.connect()
|
||||
if not status:
|
||||
current_app.logger.error(
|
||||
'Could not reconnected to database(#{0}).\n'
|
||||
'Error: {1}'.format(did, errmsg)
|
||||
)
|
||||
return internal_server_error(errormsg=msg)
|
||||
|
||||
# Make connection for database again
|
||||
|
Loading…
Reference in New Issue
Block a user