Skip to content

fix(db): add support for MariaDB 12.3 LTS and increase min. to 10.11#61554

Merged
provokateurin merged 2 commits into
masterfrom
chore/mariadb-lts
Jun 24, 2026
Merged

fix(db): add support for MariaDB 12.3 LTS and increase min. to 10.11#61554
provokateurin merged 2 commits into
masterfrom
chore/mariadb-lts

Conversation

@susnux

@susnux susnux commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

10.6 will be EOL when Nextcloud 35 is released, similar to 10.3 its still somewhat supported for enterprise Ubuntu 22.04. So as we dropped 20.04 support we can increase that exception to 10.6.

Now MariaDB is supported with active LTS version 10.11 to 12.3 (new LTS).

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@susnux susnux requested a review from a team as a code owner June 23, 2026 16:51
@susnux susnux requested review from Altahrim, icewind1991, leftybournes and provokateurin and removed request for a team June 23, 2026 16:51
@susnux susnux added 3. to review Waiting for reviews feature: database Database related DB ♻️ refactor Refactor code (not a bug fix, not a feature just refactoring) labels Jun 23, 2026
@susnux susnux added this to the Nextcloud 35 milestone Jun 23, 2026
@susnux susnux requested review from CarlSchwan and artonge June 23, 2026 16:52
@susnux susnux added the pending documentation This pull request needs an associated documentation update label Jun 23, 2026
10.6 will be EOL when Nextcloud 35 is released, similar to 10.3 its
still somewhat supported for enterprise Ubuntu 22.04.
So as we dropped 20.04 support we can increase that exception to 10.6.

Now MariaDB is supported with active LTS version 10.11 to 12.3 (new LTS).

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
->from('flow_operations')
->where($query->expr()->neq('events', $query->createNamedParameter('[]'), IQueryBuilder::PARAM_STR))
->groupBy('class', 'entity', $query->expr()->castColumn('events', IQueryBuilder::PARAM_STR));
->groupBy('class', 'entity', 'events');

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have to use the alias here, as otherwise this resulted in this SQL:

SELECT `class`, `entity`, CAST(`events` AS CHAR) AS `events` FROM `*PREFIX*flow_operations` WHERE `events` <> :dcValue1 GROUP BY `class`, `entity`, CAST(`events` AS CHAR)

This worked with MariaDB < 12 but with 12 this is considered invalid.
With this change the resulted SQL looks like this:

SELECT `class`, `entity`, CAST(`events` AS CHAR) AS `events` FROM `*PREFIX*flow_operations` WHERE `events` <> :dcValue1 GROUP BY `class`, `entity`, `events`

@susnux susnux Jun 23, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it was caused by this: https://jira.mariadb.org/browse/MDEV-36607

The problem seems that events in the GROUP BY is not clear if it refers to the alias or the real column.
So from the JIRA ticket it seems MariaDB fixed this as in < 12 it refered to the real column while now in 12 it refers to the alias which is a function and now causes a self-referencing of itself.

So the alternative would be:

@@ -125,7 +125,7 @@ class Manager implements IManager {
                $query = $this->connection->getQueryBuilder();
 
                $query->select('class', 'entity')
-                       ->selectAlias($query->expr()->castColumn('events', IQueryBuilder::PARAM_STR), 'events')
+                       ->selectAlias($query->expr()->castColumn('events', IQueryBuilder::PARAM_STR), 'str_events')
                        ->from('flow_operations')
                        ->where($query->expr()->neq('events', $query->createNamedParameter('[]'), IQueryBuilder::PARAM_STR))
                        ->groupBy('class', 'entity', $query->expr()->castColumn('events', IQueryBuilder::PARAM_STR));
@@ -133,7 +133,7 @@ class Manager implements IManager {
                $result = $query->executeQuery();
                $operations = [];
                while ($row = $result->fetchAssociative()) {
-                       $eventNames = \json_decode($row['events']);
+                       $eventNames = \json_decode($row['str_events']);
 
                        $operation = $row['class'];
                        $entity = $row['entity'];

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never mind, Oracle does not like group-by the alias so the "alternative" I suggested has to be used.

The other alternative is using a sub query but I think that is less useful here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's quite a specific case, but I guess it makes sense to mention in the dev upgrade docs?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other alternative is using a sub query but I think that is less useful here.

To make all DBs happy thats required 😔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's quite a specific case, but I guess it makes sense to mention in the dev upgrade docs?

Will do so!

@susnux susnux force-pushed the chore/mariadb-lts branch from edb9882 to 09645b8 Compare June 23, 2026 20:56
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
@provokateurin provokateurin merged commit de775e3 into master Jun 24, 2026
231 of 237 checks passed
@provokateurin provokateurin deleted the chore/mariadb-lts branch June 24, 2026 09:42
@susnux

susnux commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

documentation: nextcloud/documentation#15214

@susnux susnux removed the pending documentation This pull request needs an associated documentation update label Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews feature: database Database related DB ♻️ refactor Refactor code (not a bug fix, not a feature just refactoring)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants