From b1dbcd0932786f751363e84566cd4750701fd1c9 Mon Sep 17 00:00:00 2001 From: Murtuza Zabuawala Date: Thu, 7 Jan 2016 19:33:25 +0530 Subject: [PATCH] [Python 3 compatibility] 'qtLiteral' functions needs to return data in unicode. --- web/pgadmin/utils/driver/psycopg2/__init__.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/web/pgadmin/utils/driver/psycopg2/__init__.py b/web/pgadmin/utils/driver/psycopg2/__init__.py index 0b06e409a..fb33969e8 100644 --- a/web/pgadmin/utils/driver/psycopg2/__init__.py +++ b/web/pgadmin/utils/driver/psycopg2/__init__.py @@ -760,7 +760,14 @@ class Driver(BaseDriver): @staticmethod def qtLiteral(value): - return adapt(value).getquoted() + + res = adapt(value).getquoted() + + # Returns in bytes, we need to convert it in string + if isinstance(res, bytes): + return res.decode() + else: + return res @staticmethod def ScanKeywordExtraLookup(key):