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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
78497dbf
Commit
78497dbf
authored
Aug 28, 2012
by
Sergey Petrunya
Browse files
Options
Browse Files
Download
Plain Diff
Merge
parents
ac982b0a
2d99ea45
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
95 additions
and
11 deletions
+95
-11
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+16
-2
mysql-test/r/subselect_no_mat.result
mysql-test/r/subselect_no_mat.result
+16
-2
mysql-test/r/subselect_no_opts.result
mysql-test/r/subselect_no_opts.result
+16
-2
mysql-test/r/subselect_no_scache.result
mysql-test/r/subselect_no_scache.result
+16
-2
mysql-test/r/subselect_no_semijoin.result
mysql-test/r/subselect_no_semijoin.result
+16
-2
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+14
-0
sql/sql_select.cc
sql/sql_select.cc
+1
-1
No files found.
mysql-test/r/subselect.result
View file @
78497dbf
...
@@ -5966,7 +5966,7 @@ id select_type table type possible_keys key key_len ref rows Extra
...
@@ -5966,7 +5966,7 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
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 t1 ALL NULL NULL NULL NULL 4
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
2 SUBQUERY t1 ref a a 5 const 1
2 SUBQUERY t1 ref a a 5 const 1
Using index
DROP TABLE t1;
DROP TABLE t1;
#
#
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
...
@@ -6127,7 +6127,7 @@ set optimizer_switch=@tmp_optimizer_switch;
...
@@ -6127,7 +6127,7 @@ set optimizer_switch=@tmp_optimizer_switch;
EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
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 t1 ALL NULL NULL NULL NULL 4
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
2 SUBQUERY t1 ref a a 5 const 1
2 SUBQUERY t1 ref a a 5 const 1
Using index
DROP TABLE t1;
DROP TABLE t1;
#
#
...
@@ -6832,3 +6832,17 @@ Table_schema Table_name Index_name Rows_read
...
@@ -6832,3 +6832,17 @@ Table_schema Table_name Index_name Rows_read
test t2 b 1
test t2 b 1
set global userstat=@tmp_mdev410;
set global userstat=@tmp_mdev410;
DROP TABLE t1,t2,t3,t4;
DROP TABLE t1,t2,t3,t4;
#
# MDEV-430: Server crashes in select_describe on EXPLAIN with
# materialization+semijoin, 2 nested subqueries, aggregate functions
#
CREATE TABLE t1 (a INT, KEY(a));
INSERT INTO t1 VALUES (1),(8);
CREATE TABLE t2 (b INT, KEY(b));
INSERT INTO t2 VALUES (45),(17),(20);
EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY t1 index a a 5 NULL 1 Using where; Using index
2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index
DROP TABLE t1,t2;
mysql-test/r/subselect_no_mat.result
View file @
78497dbf
...
@@ -5967,7 +5967,7 @@ id select_type table type possible_keys key key_len ref rows Extra
...
@@ -5967,7 +5967,7 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
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 t1 ALL NULL NULL NULL NULL 4
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
2 SUBQUERY t1 ref a a 5 const 1
2 SUBQUERY t1 ref a a 5 const 1
Using index
DROP TABLE t1;
DROP TABLE t1;
#
#
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
...
@@ -6126,7 +6126,7 @@ set optimizer_switch=@tmp_optimizer_switch;
...
@@ -6126,7 +6126,7 @@ set optimizer_switch=@tmp_optimizer_switch;
EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
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 t1 ALL NULL NULL NULL NULL 4
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
2 SUBQUERY t1 ref a a 5 const 1
2 SUBQUERY t1 ref a a 5 const 1
Using index
DROP TABLE t1;
DROP TABLE t1;
#
#
...
@@ -6830,6 +6830,20 @@ Table_schema Table_name Index_name Rows_read
...
@@ -6830,6 +6830,20 @@ Table_schema Table_name Index_name Rows_read
test t2 b 1
test t2 b 1
set global userstat=@tmp_mdev410;
set global userstat=@tmp_mdev410;
DROP TABLE t1,t2,t3,t4;
DROP TABLE t1,t2,t3,t4;
#
# MDEV-430: Server crashes in select_describe on EXPLAIN with
# materialization+semijoin, 2 nested subqueries, aggregate functions
#
CREATE TABLE t1 (a INT, KEY(a));
INSERT INTO t1 VALUES (1),(8);
CREATE TABLE t2 (b INT, KEY(b));
INSERT INTO t2 VALUES (45),(17),(20);
EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY t1 index a a 5 NULL 1 Using where; Using index
2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index
DROP TABLE t1,t2;
set optimizer_switch=default;
set optimizer_switch=default;
select @@optimizer_switch like '%materialization=on%';
select @@optimizer_switch like '%materialization=on%';
@@optimizer_switch like '%materialization=on%'
@@optimizer_switch like '%materialization=on%'
...
...
mysql-test/r/subselect_no_opts.result
View file @
78497dbf
...
@@ -5963,7 +5963,7 @@ id select_type table type possible_keys key key_len ref rows Extra
...
@@ -5963,7 +5963,7 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
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 t1 ALL NULL NULL NULL NULL 4
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
2 SUBQUERY t1 ref a a 5 const 1
2 SUBQUERY t1 ref a a 5 const 1
Using index
DROP TABLE t1;
DROP TABLE t1;
#
#
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
...
@@ -6122,7 +6122,7 @@ set optimizer_switch=@tmp_optimizer_switch;
...
@@ -6122,7 +6122,7 @@ set optimizer_switch=@tmp_optimizer_switch;
EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
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 t1 ALL NULL NULL NULL NULL 4
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
2 SUBQUERY t1 ref a a 5 const 1
2 SUBQUERY t1 ref a a 5 const 1
Using index
DROP TABLE t1;
DROP TABLE t1;
#
#
...
@@ -6827,4 +6827,18 @@ Table_schema Table_name Index_name Rows_read
...
@@ -6827,4 +6827,18 @@ Table_schema Table_name Index_name Rows_read
test t2 b 1
test t2 b 1
set global userstat=@tmp_mdev410;
set global userstat=@tmp_mdev410;
DROP TABLE t1,t2,t3,t4;
DROP TABLE t1,t2,t3,t4;
#
# MDEV-430: Server crashes in select_describe on EXPLAIN with
# materialization+semijoin, 2 nested subqueries, aggregate functions
#
CREATE TABLE t1 (a INT, KEY(a));
INSERT INTO t1 VALUES (1),(8);
CREATE TABLE t2 (b INT, KEY(b));
INSERT INTO t2 VALUES (45),(17),(20);
EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY t1 index a a 5 NULL 1 Using where; Using index
2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index
DROP TABLE t1,t2;
set @optimizer_switch_for_subselect_test=null;
set @optimizer_switch_for_subselect_test=null;
mysql-test/r/subselect_no_scache.result
View file @
78497dbf
...
@@ -5972,7 +5972,7 @@ id select_type table type possible_keys key key_len ref rows Extra
...
@@ -5972,7 +5972,7 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
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 t1 ALL NULL NULL NULL NULL 4
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
2 SUBQUERY t1 ref a a 5 const 1
2 SUBQUERY t1 ref a a 5 const 1
Using index
DROP TABLE t1;
DROP TABLE t1;
#
#
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
...
@@ -6133,7 +6133,7 @@ set optimizer_switch=@tmp_optimizer_switch;
...
@@ -6133,7 +6133,7 @@ set optimizer_switch=@tmp_optimizer_switch;
EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
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 t1 ALL NULL NULL NULL NULL 4
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
2 SUBQUERY t1 ref a a 5 const 1
2 SUBQUERY t1 ref a a 5 const 1
Using index
DROP TABLE t1;
DROP TABLE t1;
#
#
...
@@ -6838,6 +6838,20 @@ Table_schema Table_name Index_name Rows_read
...
@@ -6838,6 +6838,20 @@ Table_schema Table_name Index_name Rows_read
test t2 b 1
test t2 b 1
set global userstat=@tmp_mdev410;
set global userstat=@tmp_mdev410;
DROP TABLE t1,t2,t3,t4;
DROP TABLE t1,t2,t3,t4;
#
# MDEV-430: Server crashes in select_describe on EXPLAIN with
# materialization+semijoin, 2 nested subqueries, aggregate functions
#
CREATE TABLE t1 (a INT, KEY(a));
INSERT INTO t1 VALUES (1),(8);
CREATE TABLE t2 (b INT, KEY(b));
INSERT INTO t2 VALUES (45),(17),(20);
EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY t1 index a a 5 NULL 1 Using where; Using index
2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index
DROP TABLE t1,t2;
set optimizer_switch=default;
set optimizer_switch=default;
select @@optimizer_switch like '%subquery_cache=on%';
select @@optimizer_switch like '%subquery_cache=on%';
@@optimizer_switch like '%subquery_cache=on%'
@@optimizer_switch like '%subquery_cache=on%'
...
...
mysql-test/r/subselect_no_semijoin.result
View file @
78497dbf
...
@@ -5963,7 +5963,7 @@ id select_type table type possible_keys key key_len ref rows Extra
...
@@ -5963,7 +5963,7 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
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 t1 ALL NULL NULL NULL NULL 4
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
2 SUBQUERY t1 ref a a 5 const 1
2 SUBQUERY t1 ref a a 5 const 1
Using index
DROP TABLE t1;
DROP TABLE t1;
#
#
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
...
@@ -6122,7 +6122,7 @@ set optimizer_switch=@tmp_optimizer_switch;
...
@@ -6122,7 +6122,7 @@ set optimizer_switch=@tmp_optimizer_switch;
EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
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 t1 ALL NULL NULL NULL NULL 4
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
2 SUBQUERY t1 ref a a 5 const 1
2 SUBQUERY t1 ref a a 5 const 1
Using index
DROP TABLE t1;
DROP TABLE t1;
#
#
...
@@ -6827,5 +6827,19 @@ Table_schema Table_name Index_name Rows_read
...
@@ -6827,5 +6827,19 @@ Table_schema Table_name Index_name Rows_read
test t2 b 1
test t2 b 1
set global userstat=@tmp_mdev410;
set global userstat=@tmp_mdev410;
DROP TABLE t1,t2,t3,t4;
DROP TABLE t1,t2,t3,t4;
#
# MDEV-430: Server crashes in select_describe on EXPLAIN with
# materialization+semijoin, 2 nested subqueries, aggregate functions
#
CREATE TABLE t1 (a INT, KEY(a));
INSERT INTO t1 VALUES (1),(8);
CREATE TABLE t2 (b INT, KEY(b));
INSERT INTO t2 VALUES (45),(17),(20);
EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY t1 index a a 5 NULL 1 Using where; Using index
2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index
DROP TABLE t1,t2;
set @optimizer_switch_for_subselect_test=null;
set @optimizer_switch_for_subselect_test=null;
set @join_cache_level_for_subselect_test=NULL;
set @join_cache_level_for_subselect_test=NULL;
mysql-test/t/subselect.test
View file @
78497dbf
...
@@ -5742,3 +5742,17 @@ set global userstat=@tmp_mdev410;
...
@@ -5742,3 +5742,17 @@ set global userstat=@tmp_mdev410;
DROP
TABLE
t1
,
t2
,
t3
,
t4
;
DROP
TABLE
t1
,
t2
,
t3
,
t4
;
--
echo
#
--
echo
# MDEV-430: Server crashes in select_describe on EXPLAIN with
--
echo
# materialization+semijoin, 2 nested subqueries, aggregate functions
--
echo
#
CREATE
TABLE
t1
(
a
INT
,
KEY
(
a
));
INSERT
INTO
t1
VALUES
(
1
),(
8
);
CREATE
TABLE
t2
(
b
INT
,
KEY
(
b
));
INSERT
INTO
t2
VALUES
(
45
),(
17
),(
20
);
EXPLAIN
SELECT
*
FROM
t1
WHERE
EXISTS
(
SELECT
a
FROM
t1
,
t2
WHERE
b
=
a
GROUP
BY
a
HAVING
a
<>
1
)
;
DROP
TABLE
t1
,
t2
;
sql/sql_select.cc
View file @
78497dbf
...
@@ -10543,7 +10543,7 @@ void JOIN::join_free()
...
@@ -10543,7 +10543,7 @@ void JOIN::join_free()
Optimization: if not EXPLAIN and we are done with the JOIN,
Optimization: if not EXPLAIN and we are done with the JOIN,
free all tables.
free all tables.
*/
*/
bool
full
=
!
(
select_lex
->
uncacheable
);
bool
full
=
!
(
select_lex
->
uncacheable
)
&&
!
(
thd
->
lex
->
describe
)
;
bool
can_unlock
=
full
;
bool
can_unlock
=
full
;
DBUG_ENTER
(
"JOIN::join_free"
);
DBUG_ENTER
(
"JOIN::join_free"
);
...
...
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