mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
Merge fix for bug#17711
This commit is contained in:
@@ -186,4 +186,11 @@ select count(*) from t1;
|
|||||||
count(*)
|
count(*)
|
||||||
0
|
0
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
create table t1(f1 int primary key);
|
||||||
|
insert into t1 values (4),(3),(1),(2);
|
||||||
|
delete from t1 where (@a:= f1) order by f1 limit 1;
|
||||||
|
select @a;
|
||||||
|
@a
|
||||||
|
1
|
||||||
|
drop table t1;
|
||||||
End of 4.1 tests
|
End of 4.1 tests
|
||||||
|
@@ -174,4 +174,14 @@ delete from t1 where a is null;
|
|||||||
select count(*) from t1;
|
select count(*) from t1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#17711: DELETE doesn't use index when ORDER BY, LIMIT and
|
||||||
|
# non-restricting WHERE is present.
|
||||||
|
#
|
||||||
|
create table t1(f1 int primary key);
|
||||||
|
insert into t1 values (4),(3),(1),(2);
|
||||||
|
delete from t1 where (@a:= f1) order by f1 limit 1;
|
||||||
|
select @a;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
--echo End of 4.1 tests
|
--echo End of 4.1 tests
|
||||||
|
@@ -142,7 +142,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
|
|||||||
DBUG_RETURN(-1); // This will force out message
|
DBUG_RETURN(-1); // This will force out message
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!select && limit != HA_POS_ERROR)
|
if ((!select || table->quick_keys.is_clear_all()) && limit != HA_POS_ERROR)
|
||||||
usable_index= get_index_for_order(table, (ORDER*)(order->first), limit);
|
usable_index= get_index_for_order(table, (ORDER*)(order->first), limit);
|
||||||
|
|
||||||
if (usable_index == MAX_KEY)
|
if (usable_index == MAX_KEY)
|
||||||
|
Reference in New Issue
Block a user