Skip to content

Commit

Permalink
Unquote lhs for KeyTransformIn on MariaDB
Browse files Browse the repository at this point in the history
For some reason, this is needed.
  • Loading branch information
laymonage committed Sep 6, 2020
1 parent 041237f commit 55c2c9f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/django_jsonfield_backport/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,12 @@ def as_sqlite(self, compiler, connection):


class KeyTransformIn(lookups.In):
def process_lhs(self, compiler, connection):
lhs, lhs_params = super().process_lhs(compiler, connection)
if connection.vendor == "mysql" and connection.mysql_is_mariadb:
return "JSON_UNQUOTE(%s)" % lhs, lhs_params
return lhs, lhs_params

def process_rhs(self, compiler, connection):
rhs, rhs_params = super().process_rhs(compiler, connection)
if not connection.features.has_native_json_field:
Expand Down

0 comments on commit 55c2c9f

Please sign in to comment.