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
3e876844
Commit
3e876844
authored
Oct 18, 2010
by
Sergey Glukhov
Browse files
Options
Browse Files
Download
Plain Diff
5.1-security->5.5-security merge
parents
c77992cd
e6472e8f
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
106 additions
and
5 deletions
+106
-5
mysql-test/r/explain.result
mysql-test/r/explain.result
+46
-0
mysql-test/t/explain.test
mysql-test/t/explain.test
+36
-0
sql/item_subselect.cc
sql/item_subselect.cc
+10
-5
sql/sql_select.cc
sql/sql_select.cc
+14
-0
No files found.
mysql-test/r/explain.result
View file @
3e876844
...
...
@@ -271,4 +271,50 @@ EXPLAIN SELECT c1 FROM t1 WHERE c2 = 1 AND c4 = 1 AND c5 = 1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref c2,c2_2 c2 10 const,const 3 Using where
DROP TABLE t1;
#
# Bug#56814 Explain + subselect + fulltext crashes server
#
CREATE TABLE t1(f1 VARCHAR(6) NOT NULL,
FULLTEXT KEY(f1),UNIQUE(f1));
INSERT INTO t1 VALUES ('test');
EXPLAIN SELECT 1 FROM t1
WHERE 1 > ALL((SELECT 1 FROM t1 JOIN t1 a ON (MATCH(t1.f1) AGAINST (""))
WHERE t1.f1 GROUP BY t1.f1));
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 1
2 SUBQUERY a system NULL NULL NULL NULL 1 Using filesort
2 SUBQUERY t1 fulltext f1 f1 0 1 Using where
PREPARE stmt FROM
'EXPLAIN SELECT 1 FROM t1
WHERE 1 > ALL((SELECT 1 FROM t1 RIGHT OUTER JOIN t1 a
ON (MATCH(t1.f1) AGAINST (""))
WHERE t1.f1 GROUP BY t1.f1))';
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 1
2 SUBQUERY a system NULL NULL NULL NULL 1 Using filesort
2 SUBQUERY t1 fulltext f1 f1 0 1 Using where
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 1
2 SUBQUERY a system NULL NULL NULL NULL 1 Using filesort
2 SUBQUERY t1 fulltext f1 f1 0 1 Using where
DEALLOCATE PREPARE stmt;
PREPARE stmt FROM
'EXPLAIN SELECT 1 FROM t1
WHERE 1 > ALL((SELECT 1 FROM t1 JOIN t1 a
ON (MATCH(t1.f1) AGAINST (""))
WHERE t1.f1 GROUP BY t1.f1))';
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 1
2 SUBQUERY a system NULL NULL NULL NULL 1 Using filesort
2 SUBQUERY t1 fulltext f1 f1 0 1 Using where
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 1
2 SUBQUERY a system NULL NULL NULL NULL 1 Using filesort
2 SUBQUERY t1 fulltext f1 f1 0 1 Using where
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
End of 5.1 tests.
mysql-test/t/explain.test
View file @
3e876844
...
...
@@ -238,4 +238,40 @@ EXPLAIN SELECT c1 FROM t1 WHERE c2 = 1 AND c4 = 1 AND c5 = 1;
DROP
TABLE
t1
;
--
echo
#
--
echo
# Bug#56814 Explain + subselect + fulltext crashes server
--
echo
#
CREATE
TABLE
t1
(
f1
VARCHAR
(
6
)
NOT
NULL
,
FULLTEXT
KEY
(
f1
),
UNIQUE
(
f1
));
INSERT
INTO
t1
VALUES
(
'test'
);
EXPLAIN
SELECT
1
FROM
t1
WHERE
1
>
ALL
((
SELECT
1
FROM
t1
JOIN
t1
a
ON
(
MATCH
(
t1
.
f1
)
AGAINST
(
""
))
WHERE
t1
.
f1
GROUP
BY
t1
.
f1
));
PREPARE
stmt
FROM
'EXPLAIN SELECT 1 FROM t1
WHERE 1 > ALL((SELECT 1 FROM t1 RIGHT OUTER JOIN t1 a
ON (MATCH(t1.f1) AGAINST (""))
WHERE t1.f1 GROUP BY t1.f1))'
;
EXECUTE
stmt
;
EXECUTE
stmt
;
DEALLOCATE
PREPARE
stmt
;
PREPARE
stmt
FROM
'EXPLAIN SELECT 1 FROM t1
WHERE 1 > ALL((SELECT 1 FROM t1 JOIN t1 a
ON (MATCH(t1.f1) AGAINST (""))
WHERE t1.f1 GROUP BY t1.f1))'
;
EXECUTE
stmt
;
EXECUTE
stmt
;
DEALLOCATE
PREPARE
stmt
;
DROP
TABLE
t1
;
--
echo
End
of
5.1
tests
.
sql/item_subselect.cc
View file @
3e876844
...
...
@@ -1910,21 +1910,26 @@ int subselect_single_select_engine::exec()
DBUG_RETURN
(
join
->
error
?
join
->
error
:
1
);
}
if
(
!
select_lex
->
uncacheable
&&
thd
->
lex
->
describe
&&
!
(
join
->
select_options
&
SELECT_DESCRIBE
)
&&
join
->
need_tmp
)
!
(
join
->
select_options
&
SELECT_DESCRIBE
))
{
item
->
update_used_tables
();
if
(
item
->
const_item
())
{
/*
It's necessary to keep original JOIN table because
create_sort_index() function may overwrite original
JOIN_TAB::type and wrong optimization method can be
selected on re-execution.
*/
select_lex
->
uncacheable
|=
UNCACHEABLE_EXPLAIN
;
select_lex
->
master_unit
()
->
uncacheable
|=
UNCACHEABLE_EXPLAIN
;
/*
Force join->join_tmp creation, because this subquery will be replaced
by a simple select from the materialization temp table by optimize()
called by EXPLAIN and we need to preserve the initial query structure
so we can display it.
*/
select_lex
->
uncacheable
|=
UNCACHEABLE_EXPLAIN
;
select_lex
->
master_unit
()
->
uncacheable
|=
UNCACHEABLE_EXPLAIN
;
if
(
join
->
init_save_join_tab
())
if
(
join
->
need_tmp
&&
join
->
init_save_join_tab
())
DBUG_RETURN
(
1
);
/* purecov: inspected */
}
}
...
...
sql/sql_select.cc
View file @
3e876844
...
...
@@ -2514,6 +2514,13 @@ mysql_select(THD *thd, Item ***rref_pointer_array,
{
DBUG_RETURN
(
TRUE
);
}
/*
Original join tabs might be overwritten at first
subselect execution. So we need to restore them.
*/
Item_subselect
*
subselect
=
select_lex
->
master_unit
()
->
item
;
if
(
subselect
&&
subselect
->
is_uncacheable
()
&&
join
->
reinit
())
DBUG_RETURN
(
TRUE
);
}
else
{
...
...
@@ -8956,6 +8963,13 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top)
that reject nulls => the outer join can be replaced by an inner join.
*/
table
->
outer_join
=
0
;
/*
Update TABLE::maybe_null field as it could have
the value(maybe_null==TRUE) based on the assumption
that this join is outer(see setup_table_map() func).
*/
if
(
table
->
table
)
table
->
table
->
maybe_null
=
FALSE
;
if
(
table
->
on_expr
)
{
/* Add on expression to the where condition. */
...
...
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