Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
10.5, 11.8
-
None
Description
Discovered while debugging MDEV-35848.
Preamble:
drop table if exists t1, t2;
|
create table t1 (id int primary key, v int);
|
create table t2 (id int primary key, v int);
|
insert into t1 (id, v) values (2,3),(1,4);
|
insert into t2 (id, v) values (5,5),(6,6);
|
Test case:
UPDATE t1, t2 SET t1.v=-1, t2.v=-1 ORDER BY t1.id, t2.id LIMIT 2;
|
Observed result:
MariaDB [test]> select * from t1;
|
+----+------+
|
| id | v |
|
+----+------+
|
| 1 | -1 |
|
| 2 | -1 |
|
+----+------+
|
2 rows in set (0.002 sec)
|
|
MariaDB [test]> select * from t2;
|
+----+------+
|
| id | v |
|
+----+------+
|
| 5 | -1 |
|
| 6 | 6 |
|
+----+------+
|
2 rows in set (0.001 sec)
|
Expected result:
MariaDB [test]> select * from t1;
|
+----+------+
|
| id | v |
|
+----+------+
|
| 1 | -1 |
|
| 2 | 3 |
|
+----+------+
|
2 rows in set (0.002 sec)
|
|
MariaDB [test]> select * from t2;
|
+----+------+
|
| id | v |
|
+----+------+
|
| 5 | -1 |
|
| 6 | -1 |
|
+----+------+
|
2 rows in set (0.001 sec)
|
From debugging, we see that between the calls to items1= ref_ptr_array_slice(slice_num: 2); and set_items_ref_array(src_arr: items1); (both from JOIN::make_aggr_tables_info()) the ORDER BY clause gets reversed so that t2 is before t1.
Attachments
Issue Links
- blocks
-
MDEV-35848 Multi-table DELETE with order by...limit works incorrect
-
- Closed
-
Activity
Transition | Time In Source Status | Execution Times |
---|
|
1m 35s | 1 |
|
1d 23h 3m | 1 |
|
1d 13h 55m | 1 |
|
1h 46m | 1 |