Opened 6 years ago

Last modified 6 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 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/utils.py", 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/base.py", line 71, in execute
    return self.cursor.execute(query, args)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/MySQLdb/cursors.py", line 250, in execute
    self.errorhandler(self, exc, value)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/MySQLdb/connections.py", line 50, in defaulterrorhandler
    raise errorvalue
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/MySQLdb/cursors.py", line 247, in execute
    res = self._query(query)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/MySQLdb/cursors.py", line 412, in _query
    rowcount = self._do_query(q)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/MySQLdb/cursors.py", line 375, in _do_query
    db.query(q)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/MySQLdb/connections.py", 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 by Tim Graham, 6 years ago

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 by Michal Čihař, 6 years ago

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.

https://github.com/django/django/pull/10133 would work on 2.0 just fine in case you decide to use it as a fix.

comment:3 by Claude Paroz, 6 years ago

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 by Tom Forbes, 6 years ago

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

comment:5 by Claude Paroz, 6 years ago

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 by Tim Graham, 6 years ago

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 by Tim Graham, 6 years ago

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