1
0
mirror of https://github.com/MariaDB/server.git synced 2025-09-02 09:41:40 +03:00

Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-4.1

into mysql.com:/home/psergey/mysql-4.1-bug12915-r2
This commit is contained in:
sergefp@mysql.com
2005-10-18 14:08:50 +04:00
9 changed files with 348 additions and 23 deletions

View File

@@ -263,3 +263,62 @@ test
delete from t1 where count(*)=1;
ERROR HY000: Invalid use of group function
drop table t1;
create table t1 ( a int, index (a) );
insert into t1 values (0),(0),(0),(0),(0),(0),(0),(0);
flush status;
select a from t1 order by a limit 1;
a
0
show status like 'handler_read%';
Variable_name Value
Handler_read_first 1
Handler_read_key 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
Handler_read_rnd_next 0
flush status;
update t1 set a=unix_timestamp() order by a limit 1;
show status like 'handler_read%';
Variable_name Value
Handler_read_first 1
Handler_read_key 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 1
Handler_read_rnd_next 0
flush status;
delete from t1 order by a limit 1;
show status like 'handler_read%';
Variable_name Value
Handler_read_first 1
Handler_read_key 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
Handler_read_rnd_next 0
flush status;
delete from t1 order by a desc limit 1;
show status like 'handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 1
Handler_read_rnd_next 9
alter table t1 disable keys;
flush status;
delete from t1 order by a limit 1;
show status like 'handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 1
Handler_read_rnd_next 9
select count(*) from t1;
count(*)
5
drop table t1;

View File

@@ -227,4 +227,33 @@ select DATABASE();
delete from t1 where count(*)=1;
drop table t1;
# BUG#12915: Optimize "DELETE|UPDATE ... ORDER BY ... LIMIT n" to use an index
create table t1 ( a int, index (a) );
insert into t1 values (0),(0),(0),(0),(0),(0),(0),(0);
flush status;
select a from t1 order by a limit 1;
show status like 'handler_read%';
flush status;
update t1 set a=unix_timestamp() order by a limit 1;
show status like 'handler_read%';
flush status;
delete from t1 order by a limit 1;
show status like 'handler_read%';
flush status;
delete from t1 order by a desc limit 1;
show status like 'handler_read%';
alter table t1 disable keys;
flush status;
delete from t1 order by a limit 1;
show status like 'handler_read%';
select count(*) from t1;
drop table t1;
# End of 4.1 tests