Fixed connection and version number detection issue when the database server is upgraded. Fixes #5507

pull/33/head
Yogesh Mahajan 2020-06-04 18:18:11 +05:30 committed by Akshay Joshi
parent ba91e3fc1f
commit 92d9c41da7
3 changed files with 21 additions and 23 deletions

View File

@ -23,5 +23,6 @@ Bug fixes
| `Issue #3787 <https://redmine.postgresql.org/issues/3787>`_ - Disabled the Stop process button after clicking it and added a message 'Terminating the process...' to notify the user.
| `Issue #5416 <https://redmine.postgresql.org/issues/5416>`_ - Ensure that the query tool panel gets closed when clicking on the 'Don't Save' button.
| `Issue #5465 <https://redmine.postgresql.org/issues/5465>`_ - Fixed an issue where the Edge browser version is showing wrong and warning message gets displayed.
| `Issue #5507 <https://redmine.postgresql.org/issues/5507>`_ - Fixed connection and version number detection issue when the database server is upgraded.
| `Issue #5521 <https://redmine.postgresql.org/issues/5521>`_ - Fixed an issue when dumping servers from a desktop pgAdmin app by providing an option '--sqlite-path'.
| `Issue #5539 <https://redmine.postgresql.org/issues/5539>`_ - Fixed typo in exception keyword.

View File

@ -439,28 +439,28 @@ class Connection(BaseConnection):
"Failed to setup the role with error message:\n{0}"
).format(status)
if manager.ver is None:
status = _execute(cur, "SELECT version()")
# Check database version every time on reconnection
status = _execute(cur, "SELECT version()")
if status is not None:
self.conn.close()
self.conn = None
self.wasConnected = False
current_app.logger.error(
"Failed to fetch the version information on the "
"established connection to the database server "
"(#{server_id}) for '{conn_id}' with below error "
"message:{msg}".format(
server_id=self.manager.sid,
conn_id=conn_id,
msg=status)
)
return False, status
if status is not None:
self.conn.close()
self.conn = None
self.wasConnected = False
current_app.logger.error(
"Failed to fetch the version information on the "
"established connection to the database server "
"(#{server_id}) for '{conn_id}' with below error "
"message:{msg}".format(
server_id=self.manager.sid,
conn_id=conn_id,
msg=status)
)
return False, status
if cur.rowcount > 0:
row = cur.fetchmany(1)[0]
manager.ver = row['version']
manager.sversion = self.conn.server_version
if cur.rowcount > 0:
row = cur.fetchmany(1)[0]
manager.ver = row['version']
manager.sversion = self.conn.server_version
status = _execute(cur, """
SELECT

View File

@ -263,9 +263,6 @@ WHERE db.oid = {0}""".format(did))
from pgadmin.browser.server_groups.servers.types import ServerType
self.ver = data.get('ver', None)
self.sversion = data.get('sversion', None)
if self.ver and not self.server_type:
for st in ServerType.types():
if st.instanceOf(self.ver):