Fix editing of table data with a JSON primary key. Fixes #3912

pull/21/head
Aditya Toshniwal 2019-02-20 11:15:39 +00:00 committed by Dave Page
parent ccb0796317
commit 292ac32db5
2 changed files with 10 additions and 1 deletions

View File

@ -21,6 +21,7 @@ Bug fixes
| `Bug #3544 <https://redmine.postgresql.org/issues/3544>`_ - Make the Query Tool tab titles more concise and useful.
| `Bug #3873 <https://redmine.postgresql.org/issues/3873>`_ - Fix context sub-menu alignment on Safari.
| `Bug #3906 <https://redmine.postgresql.org/issues/3906>`_ - Fix alignment of Close and Maximize button of Grant Wizard.
| `Bug #3912 <https://redmine.postgresql.org/issues/3912>`_ - Fix editing of table data with a JSON primary key.
| `Bug #3942 <https://redmine.postgresql.org/issues/3942>`_ - Close connections gracefully when the user logs out of pgAdmin.
| `Bug #3946 <https://redmine.postgresql.org/issues/3946>`_ - Fix alignment of checkbox to drop multiple schedules of pgAgent job.
| `Bug #3959 <https://redmine.postgresql.org/issues/3959>`_ - Optimise display of Dependencies and Dependents, and use on-demand loading of rows in batches of 100.

View File

@ -18,6 +18,7 @@ from flask import session
from flask_babelex import gettext
import psycopg2
from psycopg2.extensions import adapt
from psycopg2.extras import Json as psycopg2_json
import config
from pgadmin.model import Server, User
@ -225,6 +226,13 @@ class Driver(BaseDriver):
@staticmethod
def qtLiteral(value):
adapted = None
# adapt function cannot adapt dict data type
# Used http://initd.org/psycopg/docs/extras.html#json-adaptation
if type(value) == dict:
adapted = psycopg2_json(value)
else:
adapted = adapt(value)
# Not all adapted objects have encoding