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
ef97bf22
Commit
ef97bf22
authored
Oct 18, 2010
by
Sergey Petrunya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
# No BUG#, a case brought from 5.2's innodb_mysql_lock.test
- Fix a crash in nested semi-join subquery processing
parent
6f91a344
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
94 additions
and
2 deletions
+94
-2
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+18
-0
mysql-test/r/subselect_no_mat.result
mysql-test/r/subselect_no_mat.result
+18
-0
mysql-test/r/subselect_no_opts.result
mysql-test/r/subselect_no_opts.result
+18
-0
mysql-test/r/subselect_no_semijoin.result
mysql-test/r/subselect_no_semijoin.result
+18
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+21
-0
sql/opt_subselect.cc
sql/opt_subselect.cc
+1
-1
sql/sql_select.cc
sql/sql_select.cc
+0
-1
No files found.
mysql-test/r/subselect.result
View file @
ef97bf22
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t11,t12;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t11,t12;
drop view if exists v2;
set @save_optimizer_switch=@@optimizer_switch;
set @save_optimizer_switch=@@optimizer_switch;
set @@optimizer_switch="partial_match_rowid_merge=off,partial_match_table_scan=off";
set @@optimizer_switch="partial_match_rowid_merge=off,partial_match_table_scan=off";
select (select 2);
select (select 2);
...
@@ -4937,3 +4938,20 @@ SELECT * FROM t2 UNION SELECT * FROM t2
...
@@ -4937,3 +4938,20 @@ SELECT * FROM t2 UNION SELECT * FROM t2
ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE));
ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE));
DROP TABLE t1,t2;
DROP TABLE t1,t2;
End of 5.1 tests
End of 5.1 tests
#
# No BUG#, a case brought from 5.2's innodb_mysql_lock.test
#
create table t1 (i int not null primary key);
insert into t1 values (1),(2),(3),(4),(5);
create table t2 (j int not null primary key);
insert into t2 values (1),(2),(3),(4),(5);
create table t3 (k int not null primary key);
insert into t3 values (1),(2),(3);
create view v2 as select t2.j as j from t2 where t2.j in (select t1.i from t1);
select * from t3 where k in (select j from v2);
k
1
2
3
drop table t1,t2,t3;
drop view v2;
mysql-test/r/subselect_no_mat.result
View file @
ef97bf22
...
@@ -3,6 +3,7 @@ select @@optimizer_switch like '%materialization=on%';
...
@@ -3,6 +3,7 @@ select @@optimizer_switch like '%materialization=on%';
1
1
set optimizer_switch='materialization=off';
set optimizer_switch='materialization=off';
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t11,t12;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t11,t12;
drop view if exists v2;
set @save_optimizer_switch=@@optimizer_switch;
set @save_optimizer_switch=@@optimizer_switch;
set @@optimizer_switch="partial_match_rowid_merge=off,partial_match_table_scan=off";
set @@optimizer_switch="partial_match_rowid_merge=off,partial_match_table_scan=off";
select (select 2);
select (select 2);
...
@@ -4941,6 +4942,23 @@ SELECT * FROM t2 UNION SELECT * FROM t2
...
@@ -4941,6 +4942,23 @@ SELECT * FROM t2 UNION SELECT * FROM t2
ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE));
ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE));
DROP TABLE t1,t2;
DROP TABLE t1,t2;
End of 5.1 tests
End of 5.1 tests
#
# No BUG#, a case brought from 5.2's innodb_mysql_lock.test
#
create table t1 (i int not null primary key);
insert into t1 values (1),(2),(3),(4),(5);
create table t2 (j int not null primary key);
insert into t2 values (1),(2),(3),(4),(5);
create table t3 (k int not null primary key);
insert into t3 values (1),(2),(3);
create view v2 as select t2.j as j from t2 where t2.j in (select t1.i from t1);
select * from t3 where k in (select j from v2);
k
1
2
3
drop table t1,t2,t3;
drop view v2;
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 @
ef97bf22
set optimizer_switch='materialization=off,semijoin=off';
set optimizer_switch='materialization=off,semijoin=off';
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t11,t12;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t11,t12;
drop view if exists v2;
set @save_optimizer_switch=@@optimizer_switch;
set @save_optimizer_switch=@@optimizer_switch;
set @@optimizer_switch="partial_match_rowid_merge=off,partial_match_table_scan=off";
set @@optimizer_switch="partial_match_rowid_merge=off,partial_match_table_scan=off";
select (select 2);
select (select 2);
...
@@ -4938,4 +4939,21 @@ SELECT * FROM t2 UNION SELECT * FROM t2
...
@@ -4938,4 +4939,21 @@ SELECT * FROM t2 UNION SELECT * FROM t2
ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE));
ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE));
DROP TABLE t1,t2;
DROP TABLE t1,t2;
End of 5.1 tests
End of 5.1 tests
#
# No BUG#, a case brought from 5.2's innodb_mysql_lock.test
#
create table t1 (i int not null primary key);
insert into t1 values (1),(2),(3),(4),(5);
create table t2 (j int not null primary key);
insert into t2 values (1),(2),(3),(4),(5);
create table t3 (k int not null primary key);
insert into t3 values (1),(2),(3);
create view v2 as select t2.j as j from t2 where t2.j in (select t1.i from t1);
select * from t3 where k in (select j from v2);
k
1
2
3
drop table t1,t2,t3;
drop view v2;
set optimizer_switch=default;
set optimizer_switch=default;
mysql-test/r/subselect_no_semijoin.result
View file @
ef97bf22
set optimizer_switch='semijoin=off';
set optimizer_switch='semijoin=off';
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t11,t12;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t11,t12;
drop view if exists v2;
set @save_optimizer_switch=@@optimizer_switch;
set @save_optimizer_switch=@@optimizer_switch;
set @@optimizer_switch="partial_match_rowid_merge=off,partial_match_table_scan=off";
set @@optimizer_switch="partial_match_rowid_merge=off,partial_match_table_scan=off";
select (select 2);
select (select 2);
...
@@ -4938,4 +4939,21 @@ SELECT * FROM t2 UNION SELECT * FROM t2
...
@@ -4938,4 +4939,21 @@ SELECT * FROM t2 UNION SELECT * FROM t2
ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE));
ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE));
DROP TABLE t1,t2;
DROP TABLE t1,t2;
End of 5.1 tests
End of 5.1 tests
#
# No BUG#, a case brought from 5.2's innodb_mysql_lock.test
#
create table t1 (i int not null primary key);
insert into t1 values (1),(2),(3),(4),(5);
create table t2 (j int not null primary key);
insert into t2 values (1),(2),(3),(4),(5);
create table t3 (k int not null primary key);
insert into t3 values (1),(2),(3);
create view v2 as select t2.j as j from t2 where t2.j in (select t1.i from t1);
select * from t3 where k in (select j from v2);
k
1
2
3
drop table t1,t2,t3;
drop view v2;
set optimizer_switch=default;
set optimizer_switch=default;
mysql-test/t/subselect.test
View file @
ef97bf22
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
# Initialise
# Initialise
--
disable_warnings
--
disable_warnings
drop
table
if
exists
t1
,
t2
,
t3
,
t4
,
t5
,
t6
,
t7
,
t8
,
t11
,
t12
;
drop
table
if
exists
t1
,
t2
,
t3
,
t4
,
t5
,
t6
,
t7
,
t8
,
t11
,
t12
;
drop
view
if
exists
v2
;
--
enable_warnings
--
enable_warnings
set
@
save_optimizer_switch
=@@
optimizer_switch
;
set
@
save_optimizer_switch
=@@
optimizer_switch
;
...
@@ -4206,3 +4207,23 @@ DROP TABLE t1,t2;
...
@@ -4206,3 +4207,23 @@ DROP TABLE t1,t2;
--
enable_result_log
--
enable_result_log
--
echo
End
of
5.1
tests
--
echo
End
of
5.1
tests
--
echo
#
--
echo
# No BUG#, a case brought from 5.2's innodb_mysql_lock.test
--
echo
#
create
table
t1
(
i
int
not
null
primary
key
);
insert
into
t1
values
(
1
),(
2
),(
3
),(
4
),(
5
);
create
table
t2
(
j
int
not
null
primary
key
);
insert
into
t2
values
(
1
),(
2
),(
3
),(
4
),(
5
);
create
table
t3
(
k
int
not
null
primary
key
);
insert
into
t3
values
(
1
),(
2
),(
3
);
create
view
v2
as
select
t2
.
j
as
j
from
t2
where
t2
.
j
in
(
select
t1
.
i
from
t1
);
select
*
from
t3
where
k
in
(
select
j
from
v2
);
drop
table
t1
,
t2
,
t3
;
drop
view
v2
;
sql/opt_subselect.cc
View file @
ef97bf22
...
@@ -803,7 +803,7 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred)
...
@@ -803,7 +803,7 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred)
sj_nest
->
nested_join
->
sj_corr_tables
=
subq_pred
->
used_tables
();
sj_nest
->
nested_join
->
sj_corr_tables
=
subq_pred
->
used_tables
();
sj_nest
->
nested_join
->
sj_depends_on
=
subq_pred
->
used_tables
()
|
sj_nest
->
nested_join
->
sj_depends_on
=
subq_pred
->
used_tables
()
|
subq_pred
->
left_expr
->
used_tables
();
subq_pred
->
left_expr
->
used_tables
();
sj_nest
->
sj_on_expr
=
subq_lex
->
where
;
sj_nest
->
sj_on_expr
=
subq_lex
->
join
->
conds
;
/*
/*
Create the IN-equalities and inject them into semi-join's ON expression.
Create the IN-equalities and inject them into semi-join's ON expression.
...
...
sql/sql_select.cc
View file @
ef97bf22
...
@@ -553,7 +553,6 @@ JOIN::prepare(Item ***rref_pointer_array,
...
@@ -553,7 +553,6 @@ JOIN::prepare(Item ***rref_pointer_array,
}
}
int
res
=
check_and_do_in_subquery_rewrites
(
this
);
int
res
=
check_and_do_in_subquery_rewrites
(
this
);
//psergey-merge: if (!thd->lex->view_prepare_mode && !(select_options & SELECT_DESCRIBE))
select_lex
->
fix_prepare_information
(
thd
,
&
conds
,
&
having
);
select_lex
->
fix_prepare_information
(
thd
,
&
conds
,
&
having
);
...
...
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