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
fbcff7a4
Commit
fbcff7a4
authored
Oct 26, 2011
by
Sergey Petrunya
Browse files
Options
Browse Files
Download
Plain Diff
Merge fix for BUG#877288
parents
a8f7c03c
8e6440df
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
83 additions
and
1 deletion
+83
-1
mysql-test/r/subselect_sj.result
mysql-test/r/subselect_sj.result
+31
-0
mysql-test/r/subselect_sj_jcl6.result
mysql-test/r/subselect_sj_jcl6.result
+31
-0
mysql-test/t/subselect_sj.test
mysql-test/t/subselect_sj.test
+19
-0
sql/sql_select.cc
sql/sql_select.cc
+2
-1
No files found.
mysql-test/r/subselect_sj.result
View file @
fbcff7a4
...
...
@@ -1963,4 +1963,35 @@ ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your W
set max_join_size= @tmp_mjs_861147;
set optimizer_switch= @tmp_os_861147;
DROP TABLE t1,t2,t3,t4,t5,t6;
#
# BUG#877288: Wrong result with semijoin + materialization + multipart key
#
set @tmp_877288=@@optimizer_switch;
set optimizer_switch='semijoin=ON,materialization=ON';
CREATE TABLE t1 ( a int) ;
INSERT INTO t1 VALUES (19),(19),(19),(20),(20),(20),(20),(20),(20);
CREATE TABLE t2 ( b int NOT NULL , c int NOT NULL , KEY (b,c)) ;
INSERT INTO t2 VALUES (14,1),(15,1),(16,1),(17,1),(18,1),(19,1),(20,1);
CREATE TABLE t3 ( a int, d int) ;
INSERT INTO t3 VALUES (19,1),(7,1),(3,1),(3,1),(20,1),(3,1),(16,1),(17,1),(9,1),(4,1),(6,1),(15,1),(17,1);
explain
SELECT * FROM t1 WHERE (a) IN (SELECT a FROM t2 JOIN t3 ON b = a);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 9
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 5 func 1
2 SUBQUERY t3 ALL NULL NULL NULL NULL 13 Using where
2 SUBQUERY t2 ref b b 4 test.t3.a 1 Using index
SELECT * FROM t1 WHERE (a) IN (SELECT a FROM t2 JOIN t3 ON b = a);
a
19
19
19
20
20
20
20
20
20
DROP TABLE t1,t2,t3;
set optimizer_switch=@tmp_877288;
set optimizer_switch=@subselect_sj_tmp;
mysql-test/r/subselect_sj_jcl6.result
View file @
fbcff7a4
...
...
@@ -1974,6 +1974,37 @@ ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your W
set max_join_size= @tmp_mjs_861147;
set optimizer_switch= @tmp_os_861147;
DROP TABLE t1,t2,t3,t4,t5,t6;
#
# BUG#877288: Wrong result with semijoin + materialization + multipart key
#
set @tmp_877288=@@optimizer_switch;
set optimizer_switch='semijoin=ON,materialization=ON';
CREATE TABLE t1 ( a int) ;
INSERT INTO t1 VALUES (19),(19),(19),(20),(20),(20),(20),(20),(20);
CREATE TABLE t2 ( b int NOT NULL , c int NOT NULL , KEY (b,c)) ;
INSERT INTO t2 VALUES (14,1),(15,1),(16,1),(17,1),(18,1),(19,1),(20,1);
CREATE TABLE t3 ( a int, d int) ;
INSERT INTO t3 VALUES (19,1),(7,1),(3,1),(3,1),(20,1),(3,1),(16,1),(17,1),(9,1),(4,1),(6,1),(15,1),(17,1);
explain
SELECT * FROM t1 WHERE (a) IN (SELECT a FROM t2 JOIN t3 ON b = a);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 9
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 5 func 1
2 SUBQUERY t3 ALL NULL NULL NULL NULL 13 Using where
2 SUBQUERY t2 ref b b 4 test.t3.a 1 Using index
SELECT * FROM t1 WHERE (a) IN (SELECT a FROM t2 JOIN t3 ON b = a);
a
19
19
19
20
20
20
20
20
20
DROP TABLE t1,t2,t3;
set optimizer_switch=@tmp_877288;
set optimizer_switch=@subselect_sj_tmp;
#
# BUG#49129: Wrong result with IN-subquery with join_cache_level=6 and firstmatch=off
...
...
mysql-test/t/subselect_sj.test
View file @
fbcff7a4
...
...
@@ -1807,6 +1807,25 @@ set optimizer_switch= @tmp_os_861147;
DROP
TABLE
t1
,
t2
,
t3
,
t4
,
t5
,
t6
;
--
echo
#
--
echo
# BUG#877288: Wrong result with semijoin + materialization + multipart key
--
echo
#
set
@
tmp_877288
=@@
optimizer_switch
;
set
optimizer_switch
=
'semijoin=ON,materialization=ON'
;
CREATE
TABLE
t1
(
a
int
)
;
INSERT
INTO
t1
VALUES
(
19
),(
19
),(
19
),(
20
),(
20
),(
20
),(
20
),(
20
),(
20
);
CREATE
TABLE
t2
(
b
int
NOT
NULL
,
c
int
NOT
NULL
,
KEY
(
b
,
c
))
;
INSERT
INTO
t2
VALUES
(
14
,
1
),(
15
,
1
),(
16
,
1
),(
17
,
1
),(
18
,
1
),(
19
,
1
),(
20
,
1
);
CREATE
TABLE
t3
(
a
int
,
d
int
)
;
INSERT
INTO
t3
VALUES
(
19
,
1
),(
7
,
1
),(
3
,
1
),(
3
,
1
),(
20
,
1
),(
3
,
1
),(
16
,
1
),(
17
,
1
),(
9
,
1
),(
4
,
1
),(
6
,
1
),(
15
,
1
),(
17
,
1
);
explain
SELECT
*
FROM
t1
WHERE
(
a
)
IN
(
SELECT
a
FROM
t2
JOIN
t3
ON
b
=
a
);
SELECT
*
FROM
t1
WHERE
(
a
)
IN
(
SELECT
a
FROM
t2
JOIN
t3
ON
b
=
a
);
DROP
TABLE
t1
,
t2
,
t3
;
set
optimizer_switch
=@
tmp_877288
;
# The following command must be the last one the file
set
optimizer_switch
=@
subselect_sj_tmp
;
sql/sql_select.cc
View file @
fbcff7a4
...
...
@@ -7360,7 +7360,8 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j,
while
(((
~
used_tables
)
&
keyuse
->
used_tables
)
||
(
keyuse
->
keypart
!=
(
is_hash_join_key_no
(
key
)
?
keyinfo
->
key_part
[
i
].
field
->
field_index
:
i
)))
keyinfo
->
key_part
[
i
].
field
->
field_index
:
i
))
||
!
are_tables_local
(
j
,
keyuse
->
val
->
used_tables
()))
keyuse
++
;
/* Skip other parts */
uint
maybe_null
=
test
(
keyinfo
->
key_part
[
i
].
null_bit
);
...
...
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