fix(db): add support for MariaDB 12.3 LTS and increase min. to 10.11#61554
Conversation
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>
785af56 to
edb9882
Compare
| ->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'); |
There was a problem hiding this comment.
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`There was a problem hiding this comment.
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'];There was a problem hiding this comment.
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.
There was a problem hiding this comment.
That's quite a specific case, but I guess it makes sense to mention in the dev upgrade docs?
There was a problem hiding this comment.
The other alternative is using a sub query but I think that is less useful here.
To make all DBs happy thats required 😔
There was a problem hiding this comment.
That's quite a specific case, but I guess it makes sense to mention in the dev upgrade docs?
Will do so!
edb9882 to
09645b8
Compare
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
09645b8 to
248054d
Compare
|
documentation: nextcloud/documentation#15214 |
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
3. to review, feature component)stable32)AI (if applicable)