like with MariaDB 10.11.4 (active Debian Bookworm, etc.)
the ordering of the banners is 2 - 1 - 3
the ordering is retained.
Ordering of the banners is reordered to 1 - 2 - 3
You cannot change the ordering with "Drag and Drop".
Joomla! 5.0.0, 4.4.0, 4.3.4
PHP Versions 8.2.12, 8.1.25, 8.3.0RC5
MariaDB 11.1.2
I am currently developing a component and have several tables with the field "ordering". I have noticed that drag 'n drop does not work on my developer system under Arch Linux, but it does work on the production system under Debian and also on an older BSD system. To cut a long story short, I have tried all possible PHP versions and Joomla versions. However, the version of the MariaDB database plays a role:
The function in /libraries/src/table.php calls a function public function reorder($where = ''), which is processed differently.
It forms a query such as
UPDATE `j5_banners`
INNER JOIN (
SELECT * FROM (
SELECT (SELECT @rownum := @rownum + 1 FROM (SELECT @rownum := 0) AS r) AS new_ordering,`id` AS `pk__0`
FROM `j5_banners`
WHERE `ordering` >= 0
ORDER BY `ordering`
) w) AS sq
SET `ordering` = sq.new_ordering
WHERE `ordering` >= 0 AND `id` = sq.`pk__0`;
This query does reorder the table in MariaDB 10.11.4 but equals the id with ordering in MariaDB 11.1.2
Perhaps, there is also correlation to https://jira.mariadb.org/browse/MDEV-27745
| Labels |
Removed:
?
|
||
| Labels |
Added:
No Code Attached Yet
|
||
| Status | New | ⇒ | Closed |
| Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2023-11-12 20:26:25 |
| Closed_By | ⇒ | alikon |
thanks for reporting and to propose a fix please follow upstream joomla-framework/database#291
It's effect each component, not only com_banners. I have test successfully the PR 291.
Alternative PR see joomla-framework/database#300 . Please test.
See also joomla-framework/database#308 for another alternative way to do it. Please test. No, joomla-framework/database#300 is ok.
FURTHER BUG REPORT
I took a closer look at the function
reorderand found out that the query is created with a windows function which is defined in/libraries/vendor/joomla/database/src/DatabaseQuery.phpwith the following line inpublic function selectRowNumber($orderBy, $orderColumnAlias)but with
MysqlQueryBuilder.phpit is overwritten toThis no longer works, so the first variant does it quite correctly.
Since the
MysqlQueryBuilder.phpis just a "traited" class of the former classDatabaseQueryinDatabaseQuery.php, we can simply remove this function in theMysqlQueryBuilder.php: (here it is commented out)It works for:
selectRowNumberinMysqlQueryBuilder.phpGood to know:
The used SQL function
ROW_NUMBER(), is introduced in MYSQL since version 8.0 (2016/09)So the requirements for Joomla 5 with MySQL 8.1 minimum 8.0.13, and
MariaDB 11.1.0 minimum 10.4.0 should work.
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42333.