From 55c2c9fc56bcc0981521714bceed3f58d3a5cf50 Mon Sep 17 00:00:00 2001 From: sage Date: Sun, 6 Sep 2020 19:49:32 +0700 Subject: [PATCH] Unquote lhs for KeyTransformIn on MariaDB For some reason, this is needed. --- src/django_jsonfield_backport/models.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/django_jsonfield_backport/models.py b/src/django_jsonfield_backport/models.py index 4d112b9..49b73ee 100644 --- a/src/django_jsonfield_backport/models.py +++ b/src/django_jsonfield_backport/models.py @@ -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: