#37577 new Uncategorized

test_md5 and test_sha1 fail on MySQL 9.6 and later

Reported by: Mike Edmunds Owned by:
Component: Database layer (models, ORM) Version: dev
Severity: Low Keywords: tests, mysql, hashing, md5, sha1
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

MySQL 9.6 drops MD5 and SHA1 functions, see ​https://blogs.oracle.com/mysql/mysql-9-x-moving-away-from-sha1-and-md5.

This makes Django's db_functions.text.test_md5 and db_functions.text.test_sha1 fail when run against newer MySQL versions:

To reproduce using django-docker-box (output trimmed for readability):

% docker compose build mysql
% MYSQL_VERSION=9.7 docker compose run --rm mysql db_functions.text
...
ERROR: test_basic (db_functions.text.test_md5.MD5Tests.test_basic)
MySQLdb.OperationalError: (1305, 'FUNCTION test_django_2.MD5 does not exist')
...
ERROR: test_transform (db_functions.text.test_md5.MD5Tests.test_transform)
MySQLdb.OperationalError: (1305, 'FUNCTION test_django_2.MD5 does not exist')
...
ERROR: test_basic (db_functions.text.test_sha1.SHA1Tests.test_basic)
MySQLdb.OperationalError: (1305, 'FUNCTION test_django_1.SHA1 does not exist')
...
ERROR: test_transform (db_functions.text.test_sha1.SHA1Tests.test_transform)
MySQLdb.OperationalError: (1305, 'FUNCTION test_django_1.SHA1 does not exist')
django.db.utils.OperationalError: (1305, 'FUNCTION test_django_3.SHA1 does not exist')

The same tests pass with MYSQL_VERSION=8.4 (remember to docker compose down mysql-db before switching DB versions).

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top