mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2026-09-03 20:52:57 -05:00
Ensure the query tool will work with older versions of psycopg2 than we officially support, albeit without updateable resultsets. Fixes #4520
This commit is contained in:
committed by
Dave Page
parent
cbe40176c1
commit
7b65507533
@@ -896,6 +896,13 @@ class QueryToolCommand(BaseCommand, FetchedRowTracker):
|
||||
manager = driver.connection_manager(self.sid)
|
||||
conn = manager.connection(did=self.did, conn_id=self.conn_id)
|
||||
|
||||
# Get the driver version as a float
|
||||
driver_version = float('.'.join(driver.Version().split('.')[:2]))
|
||||
|
||||
# Checking for updatable resultsets uses features in psycopg 2.8
|
||||
if driver_version < 2.8:
|
||||
return False
|
||||
|
||||
# Get the path to the sql templates
|
||||
sql_path = 'sqleditor/sql/#{0}#'.format(manager.version)
|
||||
|
||||
@@ -918,6 +925,7 @@ class QueryToolCommand(BaseCommand, FetchedRowTracker):
|
||||
self.__set_updatable_results_attrs(sql_path=sql_path,
|
||||
table_oid=table_oid,
|
||||
conn=conn)
|
||||
return self.is_updatable_resultset
|
||||
|
||||
def save(self,
|
||||
changed_data,
|
||||
|
||||
Reference in New Issue
Block a user