Opened 4 years ago

Closed 3 years ago

Last modified 3 years ago

#29548 closed New feature (fixed)

Add official support for MariaDB.

Reported by: Tim Graham Owned by: Mariusz Felisiak
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: Mariusz Felisiak, Tom Forbes Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The MySQL backend mostly works with MariaDB but there are a few test failures, mainly regarding feature detection based on version number.

django-developers discussion and WIP PR.

Attachments (1)

window-expression-failures.txt (11.2 KB) - added by Tim Graham 4 years ago.

Download all attachments as: .zip

Change History (18)

comment:1 Changed 4 years ago by Claude Paroz

This PR addresses the GIS part.

comment:2 Changed 4 years ago by Mariusz Felisiak

Cc: Mariusz Felisiak added

comment:3 Changed 4 years ago by Tom Forbes

Cc: Tom Forbes added

I've fixed all the failing non-gis tests here: https://github.com/django/django/pull/10135

I've been thinking about how to best support version checking both MySQL and MariaDB. You always have to check the MariaDB and MySQL versions carefully as they are numerically comparable but not logically. connection.mysql_version > (8, 0, 0) is True for all MariaDB versions, even if the feature you're testing is not compatible. We could add a mariadb_version property that returns an object that always compares to False if the database is not Mariadb, and vice versa for mysql_version?

comment:4 Changed 4 years ago by Tim Graham <timograham@…>

In 45c035c8:

Refs #29548 -- Fixed non-GIS test failures on MariaDB.

comment:5 Changed 4 years ago by Tim Graham

I installed MariaDB 10.3 and found the attached test failures for window expressions.

Changed 4 years ago by Tim Graham

comment:6 Changed 4 years ago by Claude Paroz <claude@…>

In c28bf990:

Refs #29548 -- Fixed GIS tests on MariaDB

comment:7 Changed 4 years ago by Tom Forbes

PR for window function failures: https://github.com/django/django/pull/10228

I've not had much experience with window expressions, but after doing some exploration it seems MariaDB has a few annoying quirks. Firstly the results of a query that uses window functions are not implicitly ordered, so the ordering has to be repeated. All examples in the MariaDB KB show this: https://mariadb.com/kb/en/library/window-functions-overview/. For these tests I just added a conditional .order() call if it's MariaDB.

Secondly 'RANGE' frames have a limitation that's not present in other databases (https://jira.mariadb.org/browse/MDEV-11747). For this I just adapted the test to work around this limitation.

And lastly LEAD and LAG have no default parameter (https://jira.mariadb.org/browse/MDEV-12981). I just skipped these tests.

The PR needs more work done before it's ready, but if I don't have time I thought I would share what I've got so far for anyone else to pick up. Tests pass locally with MariaDB 10.3.

comment:8 Changed 4 years ago by Tim Graham <timograham@…>

In 4198445:

Refs #29548 -- Fixed failing window tests on MariaDB 10.3.

comment:9 Changed 3 years ago by Mariusz Felisiak

Owner: changed from nobody to Mariusz Felisiak
Status: newassigned
Summary: Add official support for MariaDBAdd official support for MariaDB.

IMO we are almost ready to close this ticket. MariaDB is now officially supported, we should document that and add release notes.

comment:10 Changed 3 years ago by Mariusz Felisiak

Has patch: set
Last edited 3 years ago by Mariusz Felisiak (previous) (diff)

comment:11 Changed 3 years ago by Claude Paroz

@felixxm your PR link is self-referencing the ticket.

comment:12 Changed 3 years ago by Mariusz Felisiak

Good point thanks, fixed.

comment:13 Changed 3 years ago by GitHub <noreply@…>

In b6c4766:

Refs #29548 -- Updated docs for MariaDB support.

comment:14 Changed 3 years ago by Mariusz Felisiak

Resolution: fixed
Status: assignedclosed

comment:15 Changed 3 years ago by GitHub <noreply@…>

In fc2536f:

Refs #29548 -- Doc'd MariaDB support for GIS database functions.

comment:16 Changed 3 years ago by GitHub <noreply@…>

In 8d52a525:

Refs #29548 -- Fixed DatabaseWrapper.display_name on MariaDB.

comment:17 Changed 3 years ago by GitHub <noreply@…>

In 6e026ae:

Refs #29548 -- Mentioned MariaDB in database system checks.

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