mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fix editing of table data with a JSON primary key. Fixes #3912
This commit is contained in:
committed by
Dave Page
parent
ccb0796317
commit
292ac32db5
@@ -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,7 +226,14 @@ class Driver(BaseDriver):
|
||||
|
||||
@staticmethod
|
||||
def qtLiteral(value):
|
||||
adapted = adapt(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
|
||||
# e.g.
|
||||
|
||||
Reference in New Issue
Block a user