Hi,

Please find minor patch to fix 'qtLiteral' function in pgAdmin4.

_Issue:_
'qtLiteral' functions returns in 'bytes' but we need to convert it in string for Python3.


Regards,
Murtuza Zabuawala
diff --git a/web/pgadmin/utils/driver/psycopg2/__init__.py b/web/pgadmin/utils/driver/psycopg2/__init__.py
index f5346ba..c24cb77 100644
--- a/web/pgadmin/utils/driver/psycopg2/__init__.py
+++ b/web/pgadmin/utils/driver/psycopg2/__init__.py
@@ -760,7 +760,12 @@ class Driver(BaseDriver):
 
     @staticmethod
     def qtLiteral(value):
-        return adapt(value).getquoted()
+        # Returns in bytes, we need to convert it in string
+        if isinstance(adapt(value).getquoted(), bytes):
+            return adapt(value).getquoted().decode()
+        else:
+            return adapt(value).getquoted()
+
 
     @staticmethod
     def ScanKeywordExtraLookup(key):
-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers

Reply via email to