Merge pull request #500 from niphlod/fix/postgresql_json
postgresql: identifies what adapter auto-loads json values
This commit is contained in:
+10
-5
@@ -2917,16 +2917,21 @@ class PostgreSQLAdapter(BaseAdapter):
|
||||
# (to be added to after_connection)
|
||||
if self.driver_name == "pg8000":
|
||||
supports_json = self.connection.server_version >= "9.2.0"
|
||||
elif (self.driver_name == "psycopg2") and \
|
||||
(self.driver.__version__ >= "2.0.12"):
|
||||
elif (self.driver_name == "psycopg2" and
|
||||
self.driver.__version__ >= "2.0.12"):
|
||||
supports_json = self.connection.server_version >= 90200
|
||||
elif self.driver_name == "zxJDBC":
|
||||
supports_json = self.connection.dbversion >= "9.2.0"
|
||||
else: supports_json = None
|
||||
else:
|
||||
supports_json = None
|
||||
if supports_json:
|
||||
self.types["json"] = "JSON"
|
||||
self.driver_auto_json = ['loads']
|
||||
else: LOGGER.debug("Your database version does not support the JSON data type (using TEXT instead)")
|
||||
if (self.driver_name == "psycopg2" and
|
||||
self.driver.__version__ >= '2.5.0'):
|
||||
self.driver_auto_json = ['loads']
|
||||
else:
|
||||
LOGGER.debug("Your database version does not support the JSON"
|
||||
" data type (using TEXT instead)")
|
||||
|
||||
def LIKE(self, first, second):
|
||||
args = (self.expand(first), self.expand(second, 'string'))
|
||||
|
||||
Reference in New Issue
Block a user