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
9fce78a4
Commit
9fce78a4
authored
Jan 30, 2012
by
Sergey Petrunya
Browse files
Options
Browse Files
Download
Plain Diff
Merge fix for BUG#922254
parents
5ca1dd8f
53fde5bb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
63 additions
and
4 deletions
+63
-4
mysql-test/r/subselect_mat.result
mysql-test/r/subselect_mat.result
+20
-0
mysql-test/r/subselect_sj_mat.result
mysql-test/r/subselect_sj_mat.result
+18
-0
mysql-test/t/subselect_sj_mat.test
mysql-test/t/subselect_sj_mat.test
+19
-0
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+6
-4
No files found.
mysql-test/r/subselect_mat.result
View file @
9fce78a4
...
...
@@ -1811,6 +1811,26 @@ a b c
4 4 2
4 4 4
DROP TABLE t1,t2;
#
# BUG#922254: Assertion `0' failed at item_cmpfunc.cc:5899: Item* Item_equal::get_first(JOIN_TAB*, Item*)
#
CREATE TABLE t1 ( a VARCHAR(3) );
CREATE TABLE t2 ( b VARCHAR(3), c VARCHAR(8), KEY(c) );
INSERT INTO t2 VALUES ('USA','Abilene'),('USA','Akron');
EXPLAIN
SELECT * FROM
( SELECT * FROM t1 ) AS alias1,
t2 AS alias2
WHERE b = a AND a IN (
SELECT alias3.c
FROM t2 AS alias3, t2 AS alias4
WHERE alias4.c = alias3.b
);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
3 MATERIALIZED alias3 ALL NULL NULL NULL NULL 2
3 MATERIALIZED alias4 index c c 11 NULL 2 Using where; Using index; Using join buffer (flat, BNL join)
DROP TABLE t1,t2;
# This must be at the end:
set optimizer_switch=@subselect_sj_mat_tmp;
set join_cache_level=@save_join_cache_level;
...
...
mysql-test/r/subselect_sj_mat.result
View file @
9fce78a4
...
...
@@ -1849,6 +1849,24 @@ a b c
4 4 2
4 4 4
DROP TABLE t1,t2;
#
# BUG#922254: Assertion `0' failed at item_cmpfunc.cc:5899: Item* Item_equal::get_first(JOIN_TAB*, Item*)
#
CREATE TABLE t1 ( a VARCHAR(3) );
CREATE TABLE t2 ( b VARCHAR(3), c VARCHAR(8), KEY(c) );
INSERT INTO t2 VALUES ('USA','Abilene'),('USA','Akron');
EXPLAIN
SELECT * FROM
( SELECT * FROM t1 ) AS alias1,
t2 AS alias2
WHERE b = a AND a IN (
SELECT alias3.c
FROM t2 AS alias3, t2 AS alias4
WHERE alias4.c = alias3.b
);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
DROP TABLE t1,t2;
# This must be at the end:
set optimizer_switch=@subselect_sj_mat_tmp;
set join_cache_level=@save_join_cache_level;
mysql-test/t/subselect_sj_mat.test
View file @
9fce78a4
...
...
@@ -1510,6 +1510,25 @@ SELECT * FROM t1 LEFT JOIN t2 ON ( a = b )
DROP
TABLE
t1
,
t2
;
--
echo
#
--
echo
# BUG#922254: Assertion `0' failed at item_cmpfunc.cc:5899: Item* Item_equal::get_first(JOIN_TAB*, Item*)
--
echo
#
CREATE
TABLE
t1
(
a
VARCHAR
(
3
)
);
CREATE
TABLE
t2
(
b
VARCHAR
(
3
),
c
VARCHAR
(
8
),
KEY
(
c
)
);
INSERT
INTO
t2
VALUES
(
'USA'
,
'Abilene'
),(
'USA'
,
'Akron'
);
EXPLAIN
SELECT
*
FROM
(
SELECT
*
FROM
t1
)
AS
alias1
,
t2
AS
alias2
WHERE
b
=
a
AND
a
IN
(
SELECT
alias3
.
c
FROM
t2
AS
alias3
,
t2
AS
alias4
WHERE
alias4
.
c
=
alias3
.
b
);
DROP
TABLE
t1
,
t2
;
--
echo
# This must be at the end:
set
optimizer_switch
=@
subselect_sj_mat_tmp
;
set
join_cache_level
=@
save_join_cache_level
;
...
...
sql/item_cmpfunc.cc
View file @
9fce78a4
...
...
@@ -5853,13 +5853,15 @@ Item* Item_equal::get_first(JOIN_TAB *context, Item *field_item)
if
(
emb_nest
&&
emb_nest
->
sj_mat_info
&&
emb_nest
->
sj_mat_info
->
is_used
)
{
/*
It's a field from an materialized semi-join. We can substitute it only
for a field from the same semi-join. Find the first of such items.
It's a field from an materialized semi-join. We can substitute it for
- a constant item
- a field from the same semi-join
Find the first of such items:
*/
while
((
item
=
it
++
))
{
if
(
it
.
get_curr_field
()
->
table
->
pos_in_table_list
->
embedding
==
emb_nest
)
if
(
item
->
const_item
()
||
it
.
get_curr_field
()
->
table
->
pos_in_table_list
->
embedding
==
emb_nest
)
{
/*
If we found given field then return NULL to avoid unnecessary
...
...
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