1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge branch '10.1' of github.com:MariaDB/server into 10.1

This commit is contained in:
Jan Lindström
2014-06-26 20:47:08 +03:00
17 changed files with 262 additions and 167 deletions

View File

@ -16,7 +16,7 @@ id select_type table type possible_keys key key_len ref rows r_rows filtered r_f
# ANALYZE DELETE will delete rows:
analyze delete from t1 where a in (2,3,4);
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 NULL 100.00 30.00 Using where
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10 100.00 30.00 Using where
select * from t1;
a
0
@ -32,7 +32,7 @@ create table t1(a int, b int);
insert into t1 select a,a from t0;
analyze update t1 set b=100+b where a in (6,7,8);
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 NULL 100.00 30.00 Using where
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10 100.00 30.00 Using where
select * from t1;
a b
0 0
@ -197,3 +197,57 @@ select * from t1;
a b
6 6
drop table t0, t1;
#
# MDEV-6393: ANALYZE SELECT crashes in Explain_query::print_explain with a non-existing column
#
create table t1 (i int);
insert into t1 values (1),(2);
analyze select a from t1;
ERROR 42S22: Unknown column 'a' in 'field list'
analyze delete from t1 where a=2;
ERROR 42S22: Unknown column 'a' in 'where clause'
analyze update t1 set a=2;
ERROR 42S22: Unknown column 'a' in 'field list'
create table t2 like t1;
insert into t2 select * from t1;
analyze update t2,t1 set t2.i=5 where t2.a=t1.a;
ERROR 42S22: Unknown column 't2.a' in 'where clause'
analyze delete t1 from t2,t1 where t2.a=t1.a;
ERROR 42S22: Unknown column 't2.a' in 'where clause'
drop table t1, t2;
#
# MDEV-6395: ANALYZE UPDATE/DELETE with impossible where does not produce any output
#
create table t1 (a int, b int, key(a));
insert into t1 values (1,1),(2,2),(3,3),(4,4),(5,5);
analyze delete from t1 where 1 > 2;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
analyze delete from t1 where a > 30 and a < 10;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
analyze update t1 set b=12345 where 1 > 2;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
analyze update t1 set b=12345 where a > 30 and a < 10;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
drop table t1;
#
# MDEV-6398: ANALYZE UPDATE does not populate r_rows
#
create table t1 (i int);
insert into t1 values (1),(2),(3),(4);
analyze update t1 set i=8;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 4 100.00 100.00
drop table t1;
#
# Check ANALYZE SELECT INTO
#
create table t1 (i int);
insert into t1 values (1);
analyze select * from t1 into @var;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 NULL 100.00 NULL
drop table t1;

View File

@ -1,5 +1,5 @@
#
# Tests for "ANALYZE $statement" feature (PostgreSQL's analog is called EXPLAIN ANALYZE)
# Tests for "ANALYZE $statement" feature
#
--disable_warnings
drop table if exists t0,t1,t2,t3;
@ -146,3 +146,55 @@ select * from t1;
drop table t0, t1;
--echo #
--echo # MDEV-6393: ANALYZE SELECT crashes in Explain_query::print_explain with a non-existing column
--echo #
create table t1 (i int);
insert into t1 values (1),(2);
--error ER_BAD_FIELD_ERROR
analyze select a from t1;
--error ER_BAD_FIELD_ERROR
analyze delete from t1 where a=2;
--error ER_BAD_FIELD_ERROR
analyze update t1 set a=2;
create table t2 like t1;
insert into t2 select * from t1;
--error ER_BAD_FIELD_ERROR
analyze update t2,t1 set t2.i=5 where t2.a=t1.a;
--error ER_BAD_FIELD_ERROR
analyze delete t1 from t2,t1 where t2.a=t1.a;
drop table t1, t2;
--echo #
--echo # MDEV-6395: ANALYZE UPDATE/DELETE with impossible where does not produce any output
--echo #
create table t1 (a int, b int, key(a));
insert into t1 values (1,1),(2,2),(3,3),(4,4),(5,5);
analyze delete from t1 where 1 > 2;
analyze delete from t1 where a > 30 and a < 10;
analyze update t1 set b=12345 where 1 > 2;
analyze update t1 set b=12345 where a > 30 and a < 10;
drop table t1;
--echo #
--echo # MDEV-6398: ANALYZE UPDATE does not populate r_rows
--echo #
create table t1 (i int);
insert into t1 values (1),(2),(3),(4);
analyze update t1 set i=8;
drop table t1;
--echo #
--echo # Check ANALYZE SELECT INTO
--echo #
create table t1 (i int);
insert into t1 values (1);
analyze select * from t1 into @var;
drop table t1;