Opened 12 minutes ago
#37576 new Uncategorized
model_fields.test_uuid.TestQuerying.test_icontains fails on MariaDB 11.4 and later
| Reported by: | Mike Edmunds | Owned by: | |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | dev |
| Severity: | Low | Keywords: | tests, mariadb, collation, uuid |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Django's model_fields.test_uuid.TestQuerying.test_icontains works on MariaDB 10.11, but fails on MariaDB 11.4, 11.8, 12.3, and 13.1.
To reproduce using django-docker-box:
% docker compose build mariadb % MARIADB_VERSION=11.4 docker compose run --rm mariadb model_fields.test_uuid.TestQuerying ... FAIL: test_icontains (model_fields.test_uuid.TestQuerying.test_icontains) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/local/lib/python3.13/unittest/case.py", line 58, in testPartExecutor yield File "/usr/local/lib/python3.13/unittest/case.py", line 651, in run self._callTestMethod(testMethod) File "/usr/local/lib/python3.13/unittest/case.py", line 606, in _callTestMethod if method() is not None: ^^^^^^^^^^^^^^^ File "/django/source/tests/model_fields/test_uuid.py", line 169, in test_icontains self.assertSequenceEqual( ^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/unittest/case.py", line 1095, in assertSequenceEqual self.fail(msg) ~~~~~~~~~^^^^^ File "/usr/local/lib/python3.13/unittest/case.py", line 732, in fail raise self.failureException(msg) ^^^^^^^^^^^^^^^ AssertionError: Sequences differ: <QuerySet []> != [<NullableUUIDModel: NullableUUIDModel object (2)>] Second sequence contains 1 additional elements. First extra element 0: <NullableUUIDModel: NullableUUIDModel object (2)> - <QuerySet []> + [<NullableUUIDModel: NullableUUIDModel object (2)>]
Verify it worked in the older version (you must stop the mariadb-db container to change versions as described in django-docker-box's readme):
% docker compose down mariadb-db % MARIADB_VERSION=10.11 docker compose run --rm mariadb model_fields.test_uuid.TestQuerying ... Found 11 test(s). Creating test database for alias 'default'... System check identified no issues (0 silenced). ..........s ---------------------------------------------------------------------- Ran 11 tests in 0.010s OK (skipped=1)
Note that test_contains in the same suite passes with all supported MariaDB versions. (django-docker-box forces ​CHARSET to "utf8mb4" , but removing that doesn't change the results.)
AI (Gemini 4 Hydrogen) hypothesizes this is because MariaDB changed utf8mb4 default collation from utf8mb4_general_ci in 10.11 to utf8mb4_uca1400_ai_ci in 11.4 (and presumably something related to native UUID-to-string coercion for the LIKE operator, though it's a bit vague when pressed on that point). I haven't verified or investigated further.
(If you get an error about mysqldump and ssl, add --parallel=1—see ​django-docker-box#80.)