Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Not a Bug
-
10.0, 10.1, 10.2
-
None
-
10.2.10
Description
In fact, this behavior was changed in scope of MDEV-8913 – that is, 10.x now works the same way as described here for MySQL, the result is sorted at random.
MariaDB [test]> SELECT `SubQuery`.`Static` AS `Random`, `SubQuery`.`Name` FROM ( SELECT RAND() AS `Random`, 1 AS `Static`, `Name` FROM `foobar` ) AS `SubQuery` ORDER BY `SubQuery`.`Random`, `SubQuery`.`Name`; |
+--------+------+ |
| Random | Name | |
+--------+------+ |
| 1 | D |
|
| 1 | A |
|
| 1 | E |
|
| 1 | C |
|
| 1 | B |
|
+--------+------+ |
5 rows in set (0.01 sec) |
|
MariaDB [test]> SELECT `SubQuery`.`Static` AS `Random`, `SubQuery`.`Name` FROM ( SELECT RAND() AS `Random`, 1 AS `Static`, `Name` FROM `foobar` ) AS `SubQuery` ORDER BY `SubQuery`.`Random`, `SubQuery`.`Name`; |
+--------+------+ |
| Random | Name | |
+--------+------+ |
| 1 | B |
|
| 1 | C |
|
| 1 | D |
|
| 1 | A |
|
| 1 | E |
|
+--------+------+ |
5 rows in set (0.00 sec) |
|
MariaDB [test]> select @@version; |
+-----------------------+ |
| @@version |
|
+-----------------------+ |
| 10.0.31-MariaDB-debug |
|
+-----------------------+ |
1 row in set (0.00 sec) |
On the other hand, MySQL 5.7 now sorts by name.
So, if it was an unfixed bug in MySQL and correct result in MariaDB, it's vice versa now, and you'll have to re-fix it.
commit fa1438cbf4307731a54ea4137d5f7d4b744cdfbc
|
Author: Oleksandr Byelkin
|
Date: Tue Oct 27 11:17:52 2015 +0100
|
|
MDEV-8913 Derived queries with same column names as final projection causes issues when using Order By
|
|
find_item_in_list() now recognize view fields like a fields even if they rever to an expression.
|
The problem of schema name do not taken into account for field with it and
|
derived table fixed.
|
Duplicating code removed
|
Attachments
Issue Links
- relates to
-
MDEV-7626 incorrect result order when reusing aliases
- Closed