[pgAdmin][RM4663] Query history throws python exception on python 2.7
Aditya Toshniwal <[email protected]>
| Newsgroups | gmane.comp.db.postgresql.pgadmin.devel |
|---|---|
| Message-ID | <CAM9w-_kEVURDS3=eSEWnqHngFGYbYjgmtWTuncFxnQR0PtGVig@mail.gmail.com> |
Hi Hackers, Attached is the tiny patch to fix exception on python 2.7 in query history. Kindly review. -- Thanks and Regards, Aditya Toshniwal Software Engineer | EnterpriseDB India | Pune "Don't Complain about Heat, Plant a TREE"
RM4663.patch
(application/octet-stream, 738 B)
diff --git a/web/pgadmin/tools/sqleditor/utils/query_history.py b/web/pgadmin/tools/sqleditor/utils/query_history.py
index 6019aba3..41c7b974 100644
--- a/web/pgadmin/tools/sqleditor/utils/query_history.py
+++ b/web/pgadmin/tools/sqleditor/utils/query_history.py
@@ -14,11 +14,12 @@ class QueryHistory:
QueryHistoryModel.dbname == dbname) \
.all()
+ # In Python 2.7, rec.query_info has buffer data type. Cast it.
return make_json_response(
data={
'status': True,
'msg': '',
- 'result': [rec.query_info for rec in result]
+ 'result': [bytes(rec.query_info) for rec in list(result)]
}
)