MariaDB fails to upgrade - unable to CAST as JSON

Bug #1752688 reported by Robert Lyon
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
High
Robert Lyon
17.10
Fix Released
High
Unassigned
18.04
Fix Released
High
Robert Lyon

Bug Description

There is a problem in htdocs/lib/db/upgrade.php on the line

 if (is_mysql() && version_compare($db_version, '5.7.8', '>=')) {

The problem is Mahara recognises both MySQL and MariaDB as being is_mysql() and their numbering systems are different (where MariaDB is around 10.* while MySQL is around 5.*)

While both are mostly compatible with each other there are some slight differences and in this case CAST as JSON is not yet available in MariaDB.

In this case we need to check which type of is_mysql() we have and if it is not 'MySQL' then we need to return the if statement as false rather than true.

Robert Lyon (robertl-9)
Changed in mahara:
assignee: nobody → Robert Lyon (robertl-9)
Revision history for this message
Robert Lyon (robertl-9) wrote :

Hmm, of course there will be no easy way to work out which flavour of mysql we have:

https://stackoverflow.com/questions/43611296/how-can-i-detect-whether-connected-database-is-mariadb-or-mysql

With the best idea being to look at variable version_comment

https://stackoverflow.com/questions/37317869/determine-if-mysql-or-percona-or-mariadb

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "master" branch: https://reviews.mahara.org/8556

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/8556
Committed: https://git.mahara.org/mahara/mahara/commit/ca22b51fa5a736d28c2ded3e6a523ca3eb5d3c0a
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit ca22b51fa5a736d28c2ded3e6a523ca3eb5d3c0a
Author: Robert Lyon <email address hidden>
Date: Fri Mar 2 09:11:41 2018 +1300

Bug 1752688: Need to check what flavour of mysql is being used

Because MariaDB does not have JSON cast type but does have a higher
version number than 5.7

behatnotneeded

Change-Id: I5a66ddb8c382a68fde189b420088bb29ef06893c
Signed-off-by: Robert Lyon <email address hidden>

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "17.10_STABLE" branch: https://reviews.mahara.org/8577

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/8577
Committed: https://git.mahara.org/mahara/mahara/commit/60d042fa7fd5d298920e5cac6d02729495008afc
Submitter: Robert Lyon (<email address hidden>)
Branch: 17.10_STABLE

commit 60d042fa7fd5d298920e5cac6d02729495008afc
Author: Robert Lyon <email address hidden>
Date: Fri Mar 2 09:11:41 2018 +1300

Bug 1752688: Need to check what flavour of mysql is being used

Because MariaDB does not have JSON cast type but does have a higher
version number than 5.7

behatnotneeded

Change-Id: I5a66ddb8c382a68fde189b420088bb29ef06893c
Signed-off-by: Robert Lyon <email address hidden>
(cherry picked from commit ca22b51fa5a736d28c2ded3e6a523ca3eb5d3c0a)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.