Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
18c51eee
Commit
18c51eee
authored
Mar 06, 2012
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Plain Diff
5.3 merge
parents
68aa3edd
f92cfdb8
Changes
21
Show whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
387 additions
and
15 deletions
+387
-15
mysql-test/r/ctype_recoding.result
mysql-test/r/ctype_recoding.result
+16
-0
mysql-test/r/derived_view.result
mysql-test/r/derived_view.result
+35
-3
mysql-test/r/join_cache.result
mysql-test/r/join_cache.result
+1
-1
mysql-test/r/myisam-big.result
mysql-test/r/myisam-big.result
+40
-0
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+1
-0
mysql-test/r/subselect_mat.result
mysql-test/r/subselect_mat.result
+51
-0
mysql-test/r/subselect_no_mat.result
mysql-test/r/subselect_no_mat.result
+1
-0
mysql-test/r/subselect_no_opts.result
mysql-test/r/subselect_no_opts.result
+1
-0
mysql-test/r/subselect_no_scache.result
mysql-test/r/subselect_no_scache.result
+1
-0
mysql-test/r/subselect_no_semijoin.result
mysql-test/r/subselect_no_semijoin.result
+1
-0
mysql-test/r/subselect_sj_mat.result
mysql-test/r/subselect_sj_mat.result
+53
-0
mysql-test/suite/innodb/r/innodb_lock_wait_timeout_1.result
mysql-test/suite/innodb/r/innodb_lock_wait_timeout_1.result
+2
-2
mysql-test/t/ctype_recoding.test
mysql-test/t/ctype_recoding.test
+18
-0
mysql-test/t/derived_view.test
mysql-test/t/derived_view.test
+34
-0
mysql-test/t/myisam-big.test
mysql-test/t/myisam-big.test
+64
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+2
-1
mysql-test/t/subselect_sj_mat.test
mysql-test/t/subselect_sj_mat.test
+40
-0
sql/item_strfunc.h
sql/item_strfunc.h
+1
-1
sql/sql_select.cc
sql/sql_select.cc
+16
-6
storage/maria/ma_bitmap.c
storage/maria/ma_bitmap.c
+1
-1
storage/maria/ma_recovery.c
storage/maria/ma_recovery.c
+8
-0
No files found.
mysql-test/r/ctype_recoding.result
View file @
18c51eee
...
@@ -267,3 +267,19 @@ drop table t1;
...
@@ -267,3 +267,19 @@ drop table t1;
create table t1(a char character set latin1 default _cp1251 0xFF);
create table t1(a char character set latin1 default _cp1251 0xFF);
ERROR 42000: Invalid default value for 'a'
ERROR 42000: Invalid default value for 'a'
End of 4.1 tests
End of 4.1 tests
SET CHARACTER SET DEFAULT;
#
# LP BUG#944504 Item_func_conv_charset tries to execute subquery constant
#
SET optimizer_switch = 'in_to_exists=on';
SET character_set_connection = utf8;
CREATE TABLE t1 ( a VARCHAR(1) );
INSERT INTO t1 VALUES ('m'),('n');
CREATE VIEW v1 AS SELECT 'w' ;
SELECT * FROM t1 WHERE a < ALL ( SELECT * FROM v1 );
ERROR HY000: Illegal mix of collations (utf8_general_ci,COERCIBLE) and (latin1_swedish_ci,IMPLICIT) for operation '<='
drop view v1;
drop table t1;
SET character_set_connection = default;
SET optimizer_switch= default;
#End of 5.3 tests
mysql-test/r/derived_view.result
View file @
18c51eee
...
@@ -429,7 +429,7 @@ join
...
@@ -429,7 +429,7 @@ join
(select * from (select * from t1 where f1 < 7 group by f1) tt where f1 > 2) z
(select * from (select * from t1 where f1 < 7 group by f1) tt where f1 > 2) z
on x.f1 = z.f1;
on x.f1 = z.f1;
id select_type table type possible_keys key key_len ref rows filtered Extra
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE <derived3> ALL
key0
NULL NULL NULL 11 100.00 Using where
1 SIMPLE <derived3> ALL
NULL
NULL NULL NULL 11 100.00 Using where
1 SIMPLE <derived5> ref key0 key0 5 tt.f1 2 100.00
1 SIMPLE <derived5> ref key0 key0 5 tt.f1 2 100.00
5 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort
5 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort
3 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort
3 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort
...
@@ -488,7 +488,7 @@ join
...
@@ -488,7 +488,7 @@ join
(select * from t1 where f1 < 7 group by f1) tt where f1 > 2 group by f1) z
(select * from t1 where f1 < 7 group by f1) tt where f1 > 2 group by f1) z
on x.f1 = z.f1;
on x.f1 = z.f1;
id select_type table type possible_keys key key_len ref rows filtered Extra
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> ALL
key0
NULL NULL NULL 11 100.00 Using where
1 PRIMARY <derived2> ALL
NULL
NULL NULL NULL 11 100.00 Using where
1 PRIMARY <derived4> ref key0 key0 5 x.f1 2 100.00
1 PRIMARY <derived4> ref key0 key0 5 x.f1 2 100.00
4 DERIVED <derived5> ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort
4 DERIVED <derived5> ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort
5 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort
5 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort
...
@@ -1595,7 +1595,7 @@ a
...
@@ -1595,7 +1595,7 @@ a
EXPLAIN
EXPLAIN
SELECT v1.a FROM v1,v2 WHERE v2.b = v1.b ORDER BY 1;
SELECT v1.a FROM v1,v2 WHERE v2.b = v1.b ORDER BY 1;
id select_type table type possible_keys key key_len ref rows Extra
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL
key0
NULL NULL NULL 3 Using where; Using filesort
1 PRIMARY <derived2> ALL
NULL
NULL NULL NULL 3 Using where; Using filesort
1 PRIMARY <derived3> ref key0 key0 5 v1.b 2
1 PRIMARY <derived3> ref key0 key0 5 v1.b 2
3 DERIVED t2 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort
3 DERIVED t2 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort
2 DERIVED t1 ALL NULL NULL NULL NULL 3 Using temporary; Using filesort
2 DERIVED t1 ALL NULL NULL NULL NULL 3 Using temporary; Using filesort
...
@@ -1939,5 +1939,37 @@ x
...
@@ -1939,5 +1939,37 @@ x
y
y
drop table t1,t2,t3;
drop table t1,t2,t3;
set SESSION optimizer_switch= @save_optimizer_switch;
set SESSION optimizer_switch= @save_optimizer_switch;
#
# LP BUG#944782: derived table from an information schema table
#
SET @save_optimizer_switch=@@optimizer_switch;
SET SESSION optimizer_switch='derived_merge=on';
SET SESSION optimizer_switch='derived_with_keys=on';
CREATE TABLE t1 (c1 int PRIMARY KEY, c2 char(5));
EXPLAIN
SELECT COUNT(*) > 0
FROM INFORMATION_SCHEMA.COLUMNS
INNER JOIN
(SELECT TABLE_SCHEMA,
GROUP_CONCAT(COLUMN_NAME ORDER BY SEQ_IN_INDEX ASC) AS COL_NAMES
FROM INFORMATION_SCHEMA.STATISTICS
GROUP BY TABLE_SCHEMA) AS UNIQUES
ON ( COLUMNS.TABLE_SCHEMA = UNIQUES.TABLE_SCHEMA);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY COLUMNS ALL NULL NULL NULL NULL NULL Open_frm_only; Scanned all databases
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
2 DERIVED STATISTICS ALL NULL NULL NULL NULL NULL Open_frm_only; Scanned all databases; Using filesort
SELECT COUNT(*) > 0
FROM INFORMATION_SCHEMA.COLUMNS
INNER JOIN
(SELECT TABLE_SCHEMA,
GROUP_CONCAT(COLUMN_NAME ORDER BY SEQ_IN_INDEX ASC) AS COL_NAMES
FROM INFORMATION_SCHEMA.STATISTICS
GROUP BY TABLE_SCHEMA) AS UNIQUES
ON ( COLUMNS.TABLE_SCHEMA = UNIQUES.TABLE_SCHEMA);
COUNT(*) > 0
1
DROP TABLE t1;
set SESSION optimizer_switch= @save_optimizer_switch;
set optimizer_switch=@exit_optimizer_switch;
set optimizer_switch=@exit_optimizer_switch;
set join_cache_level=@exit_join_cache_level;
set join_cache_level=@exit_join_cache_level;
mysql-test/r/join_cache.result
View file @
18c51eee
...
@@ -5154,7 +5154,7 @@ EXPLAIN
...
@@ -5154,7 +5154,7 @@ EXPLAIN
SELECT * FROM (SELECT DISTINCT * FROM t1) t
SELECT * FROM (SELECT DISTINCT * FROM t1) t
WHERE t.a IN (SELECT t2.a FROM t2);
WHERE t.a IN (SELECT t2.a FROM t2);
id select_type table type possible_keys key key_len ref rows Extra
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL
key0
NULL NULL NULL 3
1 PRIMARY <derived2> ALL
NULL
NULL NULL NULL 3
1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join)
1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join)
2 DERIVED t1 ALL NULL NULL NULL NULL 3 Using temporary
2 DERIVED t1 ALL NULL NULL NULL NULL 3 Using temporary
SELECT * FROM (SELECT DISTINCT * FROM t1) t
SELECT * FROM (SELECT DISTINCT * FROM t1) t
...
...
mysql-test/r/myisam-big.result
0 → 100644
View file @
18c51eee
drop table if exists t1,t2;
create table t1 (id int, sometext varchar(100)) engine=myisam;
insert into t1 values (1, "hello"),(2, "hello2"),(4, "hello3"),(4, "hello4");
create table t2 like t1;
insert into t1 select * from t1;
insert into t2 select * from t1;
insert into t1 select * from t1;
insert into t2 select * from t1;
insert into t1 select * from t1;
insert into t2 select * from t1;
insert into t1 select * from t1;
insert into t2 select * from t1;
insert into t1 select * from t1;
insert into t2 select * from t1;
insert into t1 select * from t1;
insert into t2 select * from t1;
insert into t1 select * from t1;
insert into t2 select * from t1;
insert into t1 select * from t1;
insert into t2 select * from t1;
insert into t1 select * from t1;
insert into t2 select * from t1;
insert into t1 select * from t1;
insert into t2 select * from t1;
insert into t1 select * from t1;
insert into t2 select * from t1;
insert into t1 select * from t1;
insert into t2 select * from t1;
insert into t1 select * from t1;
insert into t2 select * from t1;
insert into t1 select * from t1;
insert into t2 select * from t1;
insert into t1 select * from t1;
select count(*) from t1;
count(*)
131072
alter table t1 add index (id), add index(sometext), add index(sometext,id);
alter table t1 disable keys;
alter table t1 enable keys;
drop table t1,t2;
mysql-test/r/subselect.result
View file @
18c51eee
...
@@ -6462,6 +6462,7 @@ SELECT ( SELECT b FROM t2 WHERE b = a OR rand() * 0) FROM t1;
...
@@ -6462,6 +6462,7 @@ SELECT ( SELECT b FROM t2 WHERE b = a OR rand() * 0) FROM t1;
1
1
NULL
NULL
drop table t1,t2,t3;
drop table t1,t2,t3;
set optimizer_switch=@subselect_tmp;
#
#
# LP BUG#905353 Wrong non-empty result with a constant table,
# LP BUG#905353 Wrong non-empty result with a constant table,
# aggregate function in subquery, MyISAM or Aria
# aggregate function in subquery, MyISAM or Aria
...
...
mysql-test/r/subselect_mat.result
View file @
18c51eee
...
@@ -1913,6 +1913,57 @@ WHERE a IN (SELECT MAX(c) FROM t2 WHERE c < 4) AND b=7 AND (a IS NULL OR a=b);
...
@@ -1913,6 +1913,57 @@ WHERE a IN (SELECT MAX(c) FROM t2 WHERE c < 4) AND b=7 AND (a IS NULL OR a=b);
a b
a b
SET optimizer_switch=@save_optimizer_switch;
SET optimizer_switch=@save_optimizer_switch;
DROP TABLE t1,t2;
DROP TABLE t1,t2;
#
# BUG#946055: Crash with semijoin IN subquery when hash join is used
#
CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (7);
CREATE TABLE t2 (b int, c int, d varchar(1), e varchar(1), KEY (c), KEY (d, c));
INSERT INTO t2 VALUES
(4,2,'v','v'), (6,1,'v','v'), (0,5,'x','x'), (7,1,'x','x'),
(7,3,'i','i'), (7,1,'e','e'), (1,4,'p','p'), (1,2,'j','j');
SET @save_optimizer_switch=@@optimizer_switch;
SET @save_join_cache_level=@@join_cache_level;
SET join_cache_level=2;
EXPLAIN
SELECT a, c FROM t1, t2
WHERE (a, c) IN (SELECT s1.b, s1.c FROM t2 AS s1, t2 AS s2
WHERE s2.d = s1.e AND s1.e = (SELECT MAX(e) FROM t2));
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 1
1 PRIMARY t2 index NULL c 5 NULL 8 Using where; Using index
2 MATERIALIZED s2 ref d d 4 const 1 Using where; Using index
2 MATERIALIZED s1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
3 SUBQUERY t2 ALL NULL NULL NULL NULL 8
SELECT a, c FROM t1, t2
WHERE (a, c) IN (SELECT s1.b, s1.c FROM t2 AS s1, t2 AS s2
WHERE s2.d = s1.e AND s1.e = (SELECT MAX(e) FROM t2));
a c
7 1
7 1
7 1
SET optimizer_switch='join_cache_hashed=on';
SET join_cache_level=4;
EXPLAIN
SELECT a, c FROM t1, t2
WHERE (a, c) IN (SELECT s1.b, s1.c FROM t2 AS s1, t2 AS s2
WHERE s2.d = s1.e AND s1.e = (SELECT MAX(e) FROM t2));
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 1
1 PRIMARY t2 index NULL c 5 NULL 8 Using where; Using index
2 MATERIALIZED s2 ref d d 4 const 1 Using where; Using index
2 MATERIALIZED s1 hash_ALL NULL #hash#$hj 5 test.s2.d 8 Using where; Using join buffer (flat, BNLH join)
3 SUBQUERY t2 ALL NULL NULL NULL NULL 8
SELECT a, c FROM t1, t2
WHERE (a, c) IN (SELECT s1.b, s1.c FROM t2 AS s1, t2 AS s2
WHERE s2.d = s1.e AND s1.e = (SELECT MAX(e) FROM t2));
a c
7 1
7 1
7 1
SET optimizer_switch=@save_optimizer_switch;
SET join_cache_level=@save_join_cache_level;
DROP TABLE t1,t2;
# This must be at the end:
# This must be at the end:
set optimizer_switch=@subselect_sj_mat_tmp;
set optimizer_switch=@subselect_sj_mat_tmp;
set join_cache_level=@save_join_cache_level;
set join_cache_level=@save_join_cache_level;
...
...
mysql-test/r/subselect_no_mat.result
View file @
18c51eee
...
@@ -6461,6 +6461,7 @@ SELECT ( SELECT b FROM t2 WHERE b = a OR rand() * 0) FROM t1;
...
@@ -6461,6 +6461,7 @@ SELECT ( SELECT b FROM t2 WHERE b = a OR rand() * 0) FROM t1;
1
1
NULL
NULL
drop table t1,t2,t3;
drop table t1,t2,t3;
set optimizer_switch=@subselect_tmp;
#
#
# LP BUG#905353 Wrong non-empty result with a constant table,
# LP BUG#905353 Wrong non-empty result with a constant table,
# aggregate function in subquery, MyISAM or Aria
# aggregate function in subquery, MyISAM or Aria
...
...
mysql-test/r/subselect_no_opts.result
View file @
18c51eee
...
@@ -6457,6 +6457,7 @@ SELECT ( SELECT b FROM t2 WHERE b = a OR rand() * 0) FROM t1;
...
@@ -6457,6 +6457,7 @@ SELECT ( SELECT b FROM t2 WHERE b = a OR rand() * 0) FROM t1;
1
1
NULL
NULL
drop table t1,t2,t3;
drop table t1,t2,t3;
set optimizer_switch=@subselect_tmp;
#
#
# LP BUG#905353 Wrong non-empty result with a constant table,
# LP BUG#905353 Wrong non-empty result with a constant table,
# aggregate function in subquery, MyISAM or Aria
# aggregate function in subquery, MyISAM or Aria
...
...
mysql-test/r/subselect_no_scache.result
View file @
18c51eee
...
@@ -6468,6 +6468,7 @@ SELECT ( SELECT b FROM t2 WHERE b = a OR rand() * 0) FROM t1;
...
@@ -6468,6 +6468,7 @@ SELECT ( SELECT b FROM t2 WHERE b = a OR rand() * 0) FROM t1;
1
1
NULL
NULL
drop table t1,t2,t3;
drop table t1,t2,t3;
set optimizer_switch=@subselect_tmp;
#
#
# LP BUG#905353 Wrong non-empty result with a constant table,
# LP BUG#905353 Wrong non-empty result with a constant table,
# aggregate function in subquery, MyISAM or Aria
# aggregate function in subquery, MyISAM or Aria
...
...
mysql-test/r/subselect_no_semijoin.result
View file @
18c51eee
...
@@ -6457,6 +6457,7 @@ SELECT ( SELECT b FROM t2 WHERE b = a OR rand() * 0) FROM t1;
...
@@ -6457,6 +6457,7 @@ SELECT ( SELECT b FROM t2 WHERE b = a OR rand() * 0) FROM t1;
1
1
NULL
NULL
drop table t1,t2,t3;
drop table t1,t2,t3;
set optimizer_switch=@subselect_tmp;
#
#
# LP BUG#905353 Wrong non-empty result with a constant table,
# LP BUG#905353 Wrong non-empty result with a constant table,
# aggregate function in subquery, MyISAM or Aria
# aggregate function in subquery, MyISAM or Aria
...
...
mysql-test/r/subselect_sj_mat.result
View file @
18c51eee
...
@@ -1951,6 +1951,59 @@ WHERE a IN (SELECT MAX(c) FROM t2 WHERE c < 4) AND b=7 AND (a IS NULL OR a=b);
...
@@ -1951,6 +1951,59 @@ WHERE a IN (SELECT MAX(c) FROM t2 WHERE c < 4) AND b=7 AND (a IS NULL OR a=b);
a b
a b
SET optimizer_switch=@save_optimizer_switch;
SET optimizer_switch=@save_optimizer_switch;
DROP TABLE t1,t2;
DROP TABLE t1,t2;
#
# BUG#946055: Crash with semijoin IN subquery when hash join is used
#
CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (7);
CREATE TABLE t2 (b int, c int, d varchar(1), e varchar(1), KEY (c), KEY (d, c));
INSERT INTO t2 VALUES
(4,2,'v','v'), (6,1,'v','v'), (0,5,'x','x'), (7,1,'x','x'),
(7,3,'i','i'), (7,1,'e','e'), (1,4,'p','p'), (1,2,'j','j');
SET @save_optimizer_switch=@@optimizer_switch;
SET @save_join_cache_level=@@join_cache_level;
SET join_cache_level=2;
EXPLAIN
SELECT a, c FROM t1, t2
WHERE (a, c) IN (SELECT s1.b, s1.c FROM t2 AS s1, t2 AS s2
WHERE s2.d = s1.e AND s1.e = (SELECT MAX(e) FROM t2));
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 1
1 PRIMARY t2 index c c 5 NULL 8 Using index
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1
2 MATERIALIZED s2 ref d d 4 const 1 Using where; Using index
2 MATERIALIZED s1 ALL c NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
3 SUBQUERY t2 ALL NULL NULL NULL NULL 8
SELECT a, c FROM t1, t2
WHERE (a, c) IN (SELECT s1.b, s1.c FROM t2 AS s1, t2 AS s2
WHERE s2.d = s1.e AND s1.e = (SELECT MAX(e) FROM t2));
a c
7 1
7 1
7 1
SET optimizer_switch='join_cache_hashed=on';
SET join_cache_level=4;
EXPLAIN
SELECT a, c FROM t1, t2
WHERE (a, c) IN (SELECT s1.b, s1.c FROM t2 AS s1, t2 AS s2
WHERE s2.d = s1.e AND s1.e = (SELECT MAX(e) FROM t2));
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 1
1 PRIMARY t2 index c c 5 NULL 8 Using index
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1
2 MATERIALIZED s2 ref d d 4 const 1 Using where; Using index
2 MATERIALIZED s1 hash_ALL c #hash#$hj 10 const,test.s2.d 8 Using where; Using join buffer (flat, BNLH join)
3 SUBQUERY t2 ALL NULL NULL NULL NULL 8
SELECT a, c FROM t1, t2
WHERE (a, c) IN (SELECT s1.b, s1.c FROM t2 AS s1, t2 AS s2
WHERE s2.d = s1.e AND s1.e = (SELECT MAX(e) FROM t2));
a c
7 1
7 1
7 1
SET optimizer_switch=@save_optimizer_switch;
SET join_cache_level=@save_join_cache_level;
DROP TABLE t1,t2;
# This must be at the end:
# This must be at the end:
set optimizer_switch=@subselect_sj_mat_tmp;
set optimizer_switch=@subselect_sj_mat_tmp;
set join_cache_level=@save_join_cache_level;
set join_cache_level=@save_join_cache_level;
mysql-test/suite/innodb/r/innodb_lock_wait_timeout_1.result
View file @
18c51eee
...
@@ -104,7 +104,7 @@ id 1
...
@@ -104,7 +104,7 @@ id 1
select_type PRIMARY
select_type PRIMARY
table <derived2>
table <derived2>
type ALL
type ALL
possible_keys
key0
possible_keys
NULL
key NULL
key NULL
key_len NULL
key_len NULL
ref NULL
ref NULL
...
@@ -308,7 +308,7 @@ id 1
...
@@ -308,7 +308,7 @@ id 1
select_type PRIMARY
select_type PRIMARY
table <derived2>
table <derived2>
type ALL
type ALL
possible_keys
key0
possible_keys
NULL
key NULL
key NULL
key_len NULL
key_len NULL
ref NULL
ref NULL
...
...
mysql-test/t/ctype_recoding.test
View file @
18c51eee
...
@@ -210,3 +210,21 @@ drop table t1;
...
@@ -210,3 +210,21 @@ drop table t1;
create
table
t1
(
a
char
character
set
latin1
default
_cp1251
0xFF
);
create
table
t1
(
a
char
character
set
latin1
default
_cp1251
0xFF
);
--
echo
End
of
4.1
tests
--
echo
End
of
4.1
tests
SET
CHARACTER
SET
DEFAULT
;
--
echo
#
--
echo
# LP BUG#944504 Item_func_conv_charset tries to execute subquery constant
--
echo
#
SET
optimizer_switch
=
'in_to_exists=on'
;
SET
character_set_connection
=
utf8
;
CREATE
TABLE
t1
(
a
VARCHAR
(
1
)
);
INSERT
INTO
t1
VALUES
(
'm'
),(
'n'
);
CREATE
VIEW
v1
AS
SELECT
'w'
;
--
error
ER_CANT_AGGREGATE_2COLLATIONS
SELECT
*
FROM
t1
WHERE
a
<
ALL
(
SELECT
*
FROM
v1
);
drop
view
v1
;
drop
table
t1
;
SET
character_set_connection
=
default
;
SET
optimizer_switch
=
default
;
--
echo
#End of 5.3 tests
mysql-test/t/derived_view.test
View file @
18c51eee
...
@@ -1313,6 +1313,40 @@ drop table t1,t2,t3;
...
@@ -1313,6 +1313,40 @@ drop table t1,t2,t3;
set
SESSION
optimizer_switch
=
@
save_optimizer_switch
;
set
SESSION
optimizer_switch
=
@
save_optimizer_switch
;
--
echo
#
--
echo
# LP BUG#944782: derived table from an information schema table
--
echo
#
SET
@
save_optimizer_switch
=@@
optimizer_switch
;
SET
SESSION
optimizer_switch
=
'derived_merge=on'
;
SET
SESSION
optimizer_switch
=
'derived_with_keys=on'
;
CREATE
TABLE
t1
(
c1
int
PRIMARY
KEY
,
c2
char
(
5
));
EXPLAIN
SELECT
COUNT
(
*
)
>
0
FROM
INFORMATION_SCHEMA
.
COLUMNS
INNER
JOIN
(
SELECT
TABLE_SCHEMA
,
GROUP_CONCAT
(
COLUMN_NAME
ORDER
BY
SEQ_IN_INDEX
ASC
)
AS
COL_NAMES
FROM
INFORMATION_SCHEMA
.
STATISTICS
GROUP
BY
TABLE_SCHEMA
)
AS
UNIQUES
ON
(
COLUMNS
.
TABLE_SCHEMA
=
UNIQUES
.
TABLE_SCHEMA
);
# this query crashed in mariadb-5.5.20
SELECT
COUNT
(
*
)
>
0
FROM
INFORMATION_SCHEMA
.
COLUMNS
INNER
JOIN
(
SELECT
TABLE_SCHEMA
,
GROUP_CONCAT
(
COLUMN_NAME
ORDER
BY
SEQ_IN_INDEX
ASC
)
AS
COL_NAMES
FROM
INFORMATION_SCHEMA
.
STATISTICS
GROUP
BY
TABLE_SCHEMA
)
AS
UNIQUES
ON
(
COLUMNS
.
TABLE_SCHEMA
=
UNIQUES
.
TABLE_SCHEMA
);
DROP
TABLE
t1
;
set
SESSION
optimizer_switch
=
@
save_optimizer_switch
;
# The following command must be the last one the file
# The following command must be the last one the file
set
optimizer_switch
=@
exit_optimizer_switch
;
set
optimizer_switch
=@
exit_optimizer_switch
;
set
join_cache_level
=@
exit_join_cache_level
;
set
join_cache_level
=@
exit_join_cache_level
;
mysql-test/t/myisam-big.test
0 → 100644
View file @
18c51eee
#
# Test bugs in the MyISAM code that require more space/time
--
source
include
/
big_test
.
inc
# Initialise
--
disable_warnings
drop
table
if
exists
t1
,
t2
;
--
enable_warnings
#
# BUG#925377:
# Querying myisam table metadata while 'alter table..enable keys' is
# running may corrupt the table
#
create
table
t1
(
id
int
,
sometext
varchar
(
100
))
engine
=
myisam
;
insert
into
t1
values
(
1
,
"hello"
),(
2
,
"hello2"
),(
4
,
"hello3"
),(
4
,
"hello4"
);
create
table
t2
like
t1
;
insert
into
t1
select
*
from
t1
;
insert
into
t2
select
*
from
t1
;
insert
into
t1
select
*
from
t1
;
insert
into
t2
select
*
from
t1
;
insert
into
t1
select
*
from
t1
;
insert
into
t2
select
*
from
t1
;
insert
into
t1
select
*
from
t1
;
insert
into
t2
select
*
from
t1
;
insert
into
t1
select
*
from
t1
;
insert
into
t2
select
*
from
t1
;
insert
into
t1
select
*
from
t1
;
insert
into
t2
select
*
from
t1
;
insert
into
t1
select
*
from
t1
;
insert
into
t2
select
*
from
t1
;
insert
into
t1
select
*
from
t1
;
insert
into
t2
select
*
from
t1
;
insert
into
t1
select
*
from
t1
;
insert
into
t2
select
*
from
t1
;
insert
into
t1
select
*
from
t1
;
insert
into
t2
select
*
from
t1
;
insert
into
t1
select
*
from
t1
;
insert
into
t2
select
*
from
t1
;
insert
into
t1
select
*
from
t1
;
insert
into
t2
select
*
from
t1
;
insert
into
t1
select
*
from
t1
;
insert
into
t2
select
*
from
t1
;
insert
into
t1
select
*
from
t1
;
insert
into
t2
select
*
from
t1
;
insert
into
t1
select
*
from
t1
;
select
count
(
*
)
from
t1
;
connect
(
con2
,
localhost
,
root
,,);
connection
con2
;
alter
table
t1
add
index
(
id
),
add
index
(
sometext
),
add
index
(
sometext
,
id
);
alter
table
t1
disable
keys
;
send
alter
table
t1
enable
keys
;
connection
default
;
--
sleep
1
--
disable_query_log
--
disable_result_log
show
table
status
like
't1'
;
--
enable_query_log
--
enable_result_log
connection
con2
;
reap
;
disconnect
con2
;
connection
default
;
drop
table
t1
,
t2
;
mysql-test/t/subselect.test
View file @
18c51eee
...
@@ -5429,8 +5429,8 @@ SELECT ( SELECT b FROM t2 WHERE b = a OR b * 0) FROM t1;
...
@@ -5429,8 +5429,8 @@ SELECT ( SELECT b FROM t2 WHERE b = a OR b * 0) FROM t1;
# example with "random"
# example with "random"
SELECT
(
SELECT
b
FROM
t2
WHERE
b
=
a
OR
rand
()
*
0
)
FROM
t1
;
SELECT
(
SELECT
b
FROM
t2
WHERE
b
=
a
OR
rand
()
*
0
)
FROM
t1
;
drop
table
t1
,
t2
,
t3
;
drop
table
t1
,
t2
,
t3
;
set
optimizer_switch
=@
subselect_tmp
;
--
echo
#
--
echo
#
--
echo
# LP BUG#905353 Wrong non-empty result with a constant table,
--
echo
# LP BUG#905353 Wrong non-empty result with a constant table,
...
@@ -5444,5 +5444,6 @@ SELECT a FROM t1 WHERE ( SELECT MIN(a) = 100 );
...
@@ -5444,5 +5444,6 @@ SELECT a FROM t1 WHERE ( SELECT MIN(a) = 100 );
drop
table
t1
;
drop
table
t1
;
--
echo
# return optimizer switch changed in the beginning of this test
--
echo
# return optimizer switch changed in the beginning of this test
set
optimizer_switch
=@
subselect_tmp
;
set
optimizer_switch
=@
subselect_tmp
;
mysql-test/t/subselect_sj_mat.test
View file @
18c51eee
...
@@ -1602,6 +1602,46 @@ SET optimizer_switch=@save_optimizer_switch;
...
@@ -1602,6 +1602,46 @@ SET optimizer_switch=@save_optimizer_switch;
DROP
TABLE
t1
,
t2
;
DROP
TABLE
t1
,
t2
;
--
echo
#
--
echo
# BUG#946055: Crash with semijoin IN subquery when hash join is used
--
echo
#
CREATE
TABLE
t1
(
a
int
);
INSERT
INTO
t1
VALUES
(
7
);
CREATE
TABLE
t2
(
b
int
,
c
int
,
d
varchar
(
1
),
e
varchar
(
1
),
KEY
(
c
),
KEY
(
d
,
c
));
INSERT
INTO
t2
VALUES
(
4
,
2
,
'v'
,
'v'
),
(
6
,
1
,
'v'
,
'v'
),
(
0
,
5
,
'x'
,
'x'
),
(
7
,
1
,
'x'
,
'x'
),
(
7
,
3
,
'i'
,
'i'
),
(
7
,
1
,
'e'
,
'e'
),
(
1
,
4
,
'p'
,
'p'
),
(
1
,
2
,
'j'
,
'j'
);
SET
@
save_optimizer_switch
=@@
optimizer_switch
;
SET
@
save_join_cache_level
=@@
join_cache_level
;
SET
join_cache_level
=
2
;
EXPLAIN
SELECT
a
,
c
FROM
t1
,
t2
WHERE
(
a
,
c
)
IN
(
SELECT
s1
.
b
,
s1
.
c
FROM
t2
AS
s1
,
t2
AS
s2
WHERE
s2
.
d
=
s1
.
e
AND
s1
.
e
=
(
SELECT
MAX
(
e
)
FROM
t2
));
SELECT
a
,
c
FROM
t1
,
t2
WHERE
(
a
,
c
)
IN
(
SELECT
s1
.
b
,
s1
.
c
FROM
t2
AS
s1
,
t2
AS
s2
WHERE
s2
.
d
=
s1
.
e
AND
s1
.
e
=
(
SELECT
MAX
(
e
)
FROM
t2
));
SET
optimizer_switch
=
'join_cache_hashed=on'
;
SET
join_cache_level
=
4
;
EXPLAIN
SELECT
a
,
c
FROM
t1
,
t2
WHERE
(
a
,
c
)
IN
(
SELECT
s1
.
b
,
s1
.
c
FROM
t2
AS
s1
,
t2
AS
s2
WHERE
s2
.
d
=
s1
.
e
AND
s1
.
e
=
(
SELECT
MAX
(
e
)
FROM
t2
));
SELECT
a
,
c
FROM
t1
,
t2
WHERE
(
a
,
c
)
IN
(
SELECT
s1
.
b
,
s1
.
c
FROM
t2
AS
s1
,
t2
AS
s2
WHERE
s2
.
d
=
s1
.
e
AND
s1
.
e
=
(
SELECT
MAX
(
e
)
FROM
t2
));
SET
optimizer_switch
=@
save_optimizer_switch
;
SET
join_cache_level
=@
save_join_cache_level
;
DROP
TABLE
t1
,
t2
;
--
echo
# This must be at the end:
--
echo
# This must be at the end:
set
optimizer_switch
=@
subselect_sj_mat_tmp
;
set
optimizer_switch
=@
subselect_sj_mat_tmp
;
set
join_cache_level
=@
save_join_cache_level
;
set
join_cache_level
=@
save_join_cache_level
;
...
...
sql/item_strfunc.h
View file @
18c51eee
...
@@ -829,7 +829,7 @@ public:
...
@@ -829,7 +829,7 @@ public:
{
{
DBUG_ASSERT
(
args
[
0
]
->
fixed
);
DBUG_ASSERT
(
args
[
0
]
->
fixed
);
conv_charset
=
cs
;
conv_charset
=
cs
;
if
(
cache_if_const
&&
args
[
0
]
->
const_item
())
if
(
cache_if_const
&&
args
[
0
]
->
const_item
()
&&
!
args
[
0
]
->
with_subselect
)
{
{
uint
errors
=
0
;
uint
errors
=
0
;
String
tmp
,
*
str
=
args
[
0
]
->
val_str
(
&
tmp
);
String
tmp
,
*
str
=
args
[
0
]
->
val_str
(
&
tmp
);
...
...
sql/sql_select.cc
View file @
18c51eee
...
@@ -79,6 +79,7 @@ static bool update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,
...
@@ -79,6 +79,7 @@ static bool update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,
static
bool
sort_and_filter_keyuse
(
THD
*
thd
,
DYNAMIC_ARRAY
*
keyuse
,
static
bool
sort_and_filter_keyuse
(
THD
*
thd
,
DYNAMIC_ARRAY
*
keyuse
,
bool
skip_unprefixed_keyparts
);
bool
skip_unprefixed_keyparts
);
static
int
sort_keyuse
(
KEYUSE
*
a
,
KEYUSE
*
b
);
static
int
sort_keyuse
(
KEYUSE
*
a
,
KEYUSE
*
b
);
static
bool
are_tables_local
(
JOIN_TAB
*
jtab
,
table_map
used_tables
);
static
bool
create_ref_for_key
(
JOIN
*
join
,
JOIN_TAB
*
j
,
KEYUSE
*
org_keyuse
,
static
bool
create_ref_for_key
(
JOIN
*
join
,
JOIN_TAB
*
j
,
KEYUSE
*
org_keyuse
,
bool
allow_full_scan
,
table_map
used_tables
);
bool
allow_full_scan
,
table_map
used_tables
);
void
best_access_path
(
JOIN
*
join
,
JOIN_TAB
*
s
,
void
best_access_path
(
JOIN
*
join
,
JOIN_TAB
*
s
,
...
@@ -7365,7 +7366,8 @@ static bool create_hj_key_for_table(JOIN *join, JOIN_TAB *join_tab,
...
@@ -7365,7 +7366,8 @@ static bool create_hj_key_for_table(JOIN *join, JOIN_TAB *join_tab,
do
do
{
{
if
(
!
(
~
used_tables
&
keyuse
->
used_tables
))
if
(
!
(
~
used_tables
&
keyuse
->
used_tables
)
&&
are_tables_local
(
join_tab
,
keyuse
->
used_tables
))
{
{
if
(
first_keyuse
)
if
(
first_keyuse
)
{
{
...
@@ -7378,7 +7380,8 @@ static bool create_hj_key_for_table(JOIN *join, JOIN_TAB *join_tab,
...
@@ -7378,7 +7380,8 @@ static bool create_hj_key_for_table(JOIN *join, JOIN_TAB *join_tab,
for
(
;
curr
<
keyuse
;
curr
++
)
for
(
;
curr
<
keyuse
;
curr
++
)
{
{
if
(
curr
->
keypart
==
keyuse
->
keypart
&&
if
(
curr
->
keypart
==
keyuse
->
keypart
&&
!
(
~
used_tables
&
curr
->
used_tables
))
!
(
~
used_tables
&
curr
->
used_tables
)
&&
are_tables_local
(
join_tab
,
curr
->
used_tables
))
break
;
break
;
}
}
if
(
curr
==
keyuse
)
if
(
curr
==
keyuse
)
...
@@ -7410,7 +7413,8 @@ static bool create_hj_key_for_table(JOIN *join, JOIN_TAB *join_tab,
...
@@ -7410,7 +7413,8 @@ static bool create_hj_key_for_table(JOIN *join, JOIN_TAB *join_tab,
keyuse
=
org_keyuse
;
keyuse
=
org_keyuse
;
do
do
{
{
if
(
!
(
~
used_tables
&
keyuse
->
used_tables
))
if
(
!
(
~
used_tables
&
keyuse
->
used_tables
)
&&
are_tables_local
(
join_tab
,
keyuse
->
used_tables
))
{
{
bool
add_key_part
=
TRUE
;
bool
add_key_part
=
TRUE
;
if
(
!
first_keyuse
)
if
(
!
first_keyuse
)
...
@@ -7418,7 +7422,8 @@ static bool create_hj_key_for_table(JOIN *join, JOIN_TAB *join_tab,
...
@@ -7418,7 +7422,8 @@ static bool create_hj_key_for_table(JOIN *join, JOIN_TAB *join_tab,
for
(
KEYUSE
*
curr
=
org_keyuse
;
curr
<
keyuse
;
curr
++
)
for
(
KEYUSE
*
curr
=
org_keyuse
;
curr
<
keyuse
;
curr
++
)
{
{
if
(
curr
->
keypart
==
keyuse
->
keypart
&&
if
(
curr
->
keypart
==
keyuse
->
keypart
&&
!
(
~
used_tables
&
curr
->
used_tables
))
!
(
~
used_tables
&
curr
->
used_tables
)
&&
are_tables_local
(
join_tab
,
curr
->
used_tables
))
{
{
keyuse
->
keypart
=
NO_KEYPART
;
keyuse
->
keypart
=
NO_KEYPART
;
add_key_part
=
FALSE
;
add_key_part
=
FALSE
;
...
@@ -8826,8 +8831,13 @@ void JOIN::drop_unused_derived_keys()
...
@@ -8826,8 +8831,13 @@ void JOIN::drop_unused_derived_keys()
continue
;
continue
;
if
(
table
->
max_keys
>
1
)
if
(
table
->
max_keys
>
1
)
table
->
use_index
(
tab
->
ref
.
key
);
table
->
use_index
(
tab
->
ref
.
key
);
if
(
table
->
s
->
keys
&&
tab
->
ref
.
key
>=
0
)
if
(
table
->
s
->
keys
)
{
if
(
tab
->
ref
.
key
>=
0
)
tab
->
ref
.
key
=
0
;
tab
->
ref
.
key
=
0
;
else
table
->
s
->
keys
=
0
;
}
tab
->
keys
=
(
key_map
)
(
table
->
s
->
keys
?
1
:
0
);
tab
->
keys
=
(
key_map
)
(
table
->
s
->
keys
?
1
:
0
);
}
}
}
}
...
...
storage/maria/ma_bitmap.c
View file @
18c51eee
...
@@ -370,7 +370,7 @@ static inline void _ma_bitmap_mark_file_changed(MARIA_SHARE *share,
...
@@ -370,7 +370,7 @@ static inline void _ma_bitmap_mark_file_changed(MARIA_SHARE *share,
if
(
flush_translog
&&
share
->
now_transactional
)
if
(
flush_translog
&&
share
->
now_transactional
)
(
void
)
translog_flush
(
share
->
state
.
logrec_file_id
);
(
void
)
translog_flush
(
share
->
state
.
logrec_file_id
);
_ma_mark_file_changed
(
share
);
_ma_mark_file_changed
_now
(
share
);
mysql_mutex_lock
(
&
share
->
bitmap
.
bitmap_lock
);
mysql_mutex_lock
(
&
share
->
bitmap
.
bitmap_lock
);
/* purecov: end */
/* purecov: end */
}
}
...
...
storage/maria/ma_recovery.c
View file @
18c51eee
...
@@ -665,11 +665,13 @@ prototype_redo_exec_hook_dummy(INCOMPLETE_GROUP)
...
@@ -665,11 +665,13 @@ prototype_redo_exec_hook_dummy(INCOMPLETE_GROUP)
prototype_redo_exec_hook
(
INCOMPLETE_LOG
)
prototype_redo_exec_hook
(
INCOMPLETE_LOG
)
{
{
MARIA_HA
*
info
;
MARIA_HA
*
info
;
if
(
skip_DDLs
)
if
(
skip_DDLs
)
{
{
tprint
(
tracef
,
"we skip DDLs
\n
"
);
tprint
(
tracef
,
"we skip DDLs
\n
"
);
return
0
;
return
0
;
}
}
if
((
info
=
get_MARIA_HA_from_REDO_record
(
rec
))
==
NULL
)
if
((
info
=
get_MARIA_HA_from_REDO_record
(
rec
))
==
NULL
)
{
{
/* no such table, don't need to warn */
/* no such table, don't need to warn */
...
@@ -1481,7 +1483,13 @@ end:
...
@@ -1481,7 +1483,13 @@ end:
if
(
error
)
if
(
error
)
{
{
if
(
info
!=
NULL
)
if
(
info
!=
NULL
)
{
/* let maria_close() mark the table properly closed */
info
->
s
->
state
.
open_count
=
1
;
info
->
s
->
global_changed
=
1
;
info
->
s
->
changed
=
1
;
maria_close
(
info
);
maria_close
(
info
);
}
if
(
error
==
-
1
)
if
(
error
==
-
1
)
error
=
0
;
error
=
0
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment