Opened 2 years ago

Last modified 2 years ago

#29544 closed Bug

Django 2.0.7 broke regex lookup on MariaDB — at Version 7

Reported by: Michal Čihař Owned by: nobody
Component: Database layer (models, ORM) Version: 2.0
Severity: Release blocker Keywords:
Cc: Adam (Chainz) Johnson Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Tim Graham)

Since Django 2.0.7 it fails to do regex lookups on MariaDB. The problem is in code introduced for #29451 - it assumes that MariaDB 10.3 has REGEXP_LIKE what is not true.

The exception is:

Traceback (most recent call last):
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/django/db/backends/", line 85, in _execute
    return self.cursor.execute(sql, params)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/django/db/backends/mysql/", line 71, in execute
    return self.cursor.execute(query, args)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/MySQLdb/", line 250, in execute
    self.errorhandler(self, exc, value)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/MySQLdb/", line 50, in defaulterrorhandler
    raise errorvalue
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/MySQLdb/", line 247, in execute
    res = self._query(query)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/MySQLdb/", line 412, in _query
    rowcount = self._do_query(q)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/MySQLdb/", line 375, in _do_query
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/MySQLdb/", line 276, in query
    _mysql.connection.query(self, query)
_mysql_exceptions.OperationalError: (1305, 'FUNCTION test_weblate.REGEXP_LIKE does not exist')

Change History (7)

comment:1 Changed 2 years ago by Tim Graham

Component: UncategorizedDatabase layer (models, ORM)
Summary: MariaDB regression in 2.0.7 in REGEXP_LIKEAdd a MariaDB database backend
Triage Stage: UnreviewedAccepted
Type: UncategorizedNew feature
Version: 2.0master

Django doesn't officially support MariaDB. There's been some discussion about adding support. There are some other tickets like #27676.

comment:2 Changed 2 years ago by Michal Čihař

The problem I see is that it worked just fine all versions up to 2.0.7 and it broke in 2.0.7 due to fix for MySQL 8.0. The other tickets seem to be about adding support for new features introduced by MariaDB, while this one is about fixing what used to work before. would work on 2.0 just fine in case you decide to use it as a fix.

comment:3 Changed 2 years ago by Claude Paroz

Severity: NormalRelease blocker

Even if it is not officially supported, I think we should do everything we can to not break it.
I have sites in production with MariaDB!

comment:4 Changed 2 years ago by Tom Forbes

It would be possible to fix the patch I made by detecting MariaDB (or more specifically, MySQL) and triggering the correct implementation?

comment:5 Changed 2 years ago by Claude Paroz

Absolutely, but patches are waiting for a CI instance with MariaDB. Even if we know there are some failures with MariaDB, at least this would prevent massive breakage like this one (I don't blame you or anyone else, to be clear).

comment:6 Changed 2 years ago by Tim Graham

Has patch: set
Summary: Add a MariaDB database backendDjango 2.0.7 broke regex lookup on MariaDB
Triage Stage: AcceptedReady for checkin
Type: New featureBug
Version: master2.0

comment:7 Changed 2 years ago by Tim Graham

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top