#36689: Top-level __in lookup on JSONField fails on MySQL, Oracle
-------------------------------------+-------------------------------------
Reporter: Jacob Walls | Type: Bug
Status: new | Component: Database
| layer (models, ORM)
Version: dev | Severity: Normal
Keywords: JSON, In | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
This test for `test_jsonfield.TestQuerying` passes on SQLite, Postgres,
and MariaDB.
{{{#!py
def test_in(self):
self.assertSequenceEqual(
NullableJSONModel.objects.filter(value__in=[{}]),
[self.objs[2]],
)
}}}
Fails on MySQL and Oracle. Clifford
[https://github.com/django/django/pull/19794#issuecomment-3447789894
suspects] the specialization in `KeyTransformIn` is missing in the top-
level `In` lookup.
Failure on MySQL:
{{{#!py
======================================================================
FAIL: test_in (model_fields.test_jsonfield.TestQuerying.test_in)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/django/source/tests/model_fields/test_jsonfield.py", line 379, in
test_in
self.assertSequenceEqual(
AssertionError: Sequences differ: <QuerySet []> != [<NullableJSONModel:
NullableJSONModel object (3)>]
Second sequence contains 1 additional elements.
First extra element 0:
<NullableJSONModel: NullableJSONModel object (3)>
- <QuerySet []>
+ [<NullableJSONModel: NullableJSONModel object (3)>]
----------------------------------------------------------------------
(0.001) SELECT `model_fields_nullablejsonmodel`.`id`,
`model_fields_nullablejsonmodel`.`value`,
`model_fields_nullablejsonmodel`.`value_custom`
FROM `model_fields_nullablejsonmodel`
WHERE `model_fields_nullablejsonmodel`.`value` IN ('{}'); args=('{}',);
alias=default
----------------------------------------------------------------------
}}}
Failure on Oracle:
{{{#!py
django.db.utils.DatabaseError: ORA-22848: cannot use NCLOB type as
comparison key
Help: https://docs.oracle.com/error-help/db/ora-22848/
----------------------------------------------------------------------
(0.016) SELECT "MODEL_FIELDS_NULLABLEJSONMODEL"."ID",
"MODEL_FIELDS_NULLABLEJSONMODEL"."VALUE",
"MODEL_FIELDS_NULLABLEJSONMODEL"."VALUE_CUSTOM"
FROM "MODEL_FIELDS_NULLABLEJSONMODEL"
WHERE "MODEL_FIELDS_NULLABLEJSONMODEL"."VALUE" IN ({}); args=('{}',);
alias=default
----------------------------------------------------------------------
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36689>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/0107019a25f4e658-113ac4bf-869f-4c75-9ade-7af50a2300c9-000000%40eu-central-1.amazonses.com.