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
2a6217a9
Commit
2a6217a9
authored
Mar 23, 2006
by
ramil@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for bug #18306: MySQL crashes and restarts using subquery
parent
12dadb00
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
3 deletions
+29
-3
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+6
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+11
-0
sql/opt_range.cc
sql/opt_range.cc
+12
-3
No files found.
mysql-test/r/subselect.result
View file @
2a6217a9
...
@@ -3163,3 +3163,9 @@ t
...
@@ -3163,3 +3163,9 @@ t
crash1
crash1
crash1
crash1
drop table t1;
drop table t1;
create table t1 (c int, key(c));
insert into t1 values (1142477582), (1142455969);
create table t2 (a int, b int);
insert into t2 values (2, 1), (1, 0);
delete from t1 where c <= 1140006215 and (select b from t2 where a = 2) = 1;
drop table t1, t2;
mysql-test/t/subselect.test
View file @
2a6217a9
...
@@ -2074,3 +2074,14 @@ create table t1( f1 int,f2 int);
...
@@ -2074,3 +2074,14 @@ create table t1( f1 int,f2 int);
insert
into
t1
values
(
1
,
1
),(
2
,
2
);
insert
into
t1
values
(
1
,
1
),(
2
,
2
);
select
tt
.
t
from
(
select
'crash1'
as
t
,
f2
from
t1
)
as
tt
left
join
t1
on
tt
.
t
=
'crash2'
and
tt
.
f2
=
t1
.
f2
where
tt
.
t
=
'crash1'
;
select
tt
.
t
from
(
select
'crash1'
as
t
,
f2
from
t1
)
as
tt
left
join
t1
on
tt
.
t
=
'crash2'
and
tt
.
f2
=
t1
.
f2
where
tt
.
t
=
'crash1'
;
drop
table
t1
;
drop
table
t1
;
#
# Bug #18306: server crash on delete using subquery.
#
create
table
t1
(
c
int
,
key
(
c
));
insert
into
t1
values
(
1142477582
),
(
1142455969
);
create
table
t2
(
a
int
,
b
int
);
insert
into
t2
values
(
2
,
1
),
(
1
,
0
);
delete
from
t1
where
c
<=
1140006215
and
(
select
b
from
t2
where
a
=
2
)
=
1
;
drop
table
t1
,
t2
;
sql/opt_range.cc
View file @
2a6217a9
...
@@ -3604,9 +3604,18 @@ static SEL_TREE *get_mm_tree(PARAM *param,COND *cond)
...
@@ -3604,9 +3604,18 @@ static SEL_TREE *get_mm_tree(PARAM *param,COND *cond)
/* Here when simple cond */
/* Here when simple cond */
if
(
cond
->
const_item
())
if
(
cond
->
const_item
())
{
{
if
(
cond
->
val_int
())
/*
DBUG_RETURN
(
new
SEL_TREE
(
SEL_TREE
::
ALWAYS
));
During the cond->val_int() evaluation we can come across a subselect
DBUG_RETURN
(
new
SEL_TREE
(
SEL_TREE
::
IMPOSSIBLE
));
item which may allocate memory on the thd->mem_root and assumes
all the memory allocated has the same life span as the subselect
item itself. So we have to restore the thread's mem_root here.
*/
MEM_ROOT
*
tmp_root
=
param
->
mem_root
;
param
->
thd
->
mem_root
=
param
->
old_root
;
tree
=
cond
->
val_int
()
?
new
(
tmp_root
)
SEL_TREE
(
SEL_TREE
::
ALWAYS
)
:
new
(
tmp_root
)
SEL_TREE
(
SEL_TREE
::
IMPOSSIBLE
);
param
->
thd
->
mem_root
=
tmp_root
;
DBUG_RETURN
(
tree
);
}
}
table_map
ref_tables
=
0
;
table_map
ref_tables
=
0
;
...
...
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