Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Not a Bug
-
5.5, 10.0, 10.1
-
10.1.24
Description
DROP TABLE IF EXISTS `foobar`;
|
CREATE TABLE IF NOT EXISTS `foobar` (
|
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
`name` VARCHAR(45) NULL )
|
ENGINE = InnoDB;
|
|
INSERT INTO `foobar` (`name`) VALUES ('A');
|
INSERT INTO `foobar` (`name`) VALUES ('B');
|
INSERT INTO `foobar` (`name`) VALUES ('C');
|
INSERT INTO `foobar` (`name`) VALUES ('D');
|
INSERT INTO `foobar` (`name`) VALUES ('E');
|
|
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`;
|
When executing in MySQL the result is sorted correctly at random. In MariaDB the result is incorrectly sorted alphabetically by name. When renaming the first alias (`SubQuery`.`Static` AS `Random`) to `Random2`, the sorting is correct in MariaDB, too.
Attachments
Issue Links
- relates to
-
MDEV-12872 incorrect result order when reusing aliases
- Closed