[MDEV-13662] MariaDB 10.1 user-define variables and order by question ? Created: 2017-08-28 Updated: 2017-08-31 Resolved: 2017-08-30 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 10.1.22, 10.1.26 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | sysdljr | Assignee: | Unassigned |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Cent OS 6.7 |
||
| Description |
|
Hi,
result on produce server (MariaDB 10.1.22)
after upgrade to 10.1.26, it is same result. on MySQL 5.7.17, this is we want to get result.
We could not confirm , it is MairaDB optimizer and MySQL's different or bug, or others cause ? |
| Comments |
| Comment by Elena Stepanova [ 2017-08-30 ] |
|
Your query is non-deterministic by its nature, neither in MySQL nor in MariaDB. You shouldn't be using queries like that in production. First, ORDER BY clause in a subquery is meaningless, it does not guarantee anything. See more details here: https://mariadb.com/kb/en/the-mariadb-library/why-is-order-by-in-a-from-subquery-ignored Second, assigning and using variables in the same query causes undefined behavior, it is documented both in MySQL manual and in MariaDB KB.
https://mariadb.com/kb/en/the-mariadb-library/user-defined-variables/
|
| Comment by sysdljr [ 2017-08-31 ] |
|
ok, many thanks for your kind reply. |