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
1ff21a9e
Commit
1ff21a9e
authored
Jun 24, 2004
by
serg@serg.mylan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug#4089 - JOIN::join_free calling mysql_unlock w/o index_end() before
parent
334eb773
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
59 additions
and
17 deletions
+59
-17
mysql-test/r/bdb.result
mysql-test/r/bdb.result
+20
-0
mysql-test/t/bdb.test
mysql-test/t/bdb.test
+10
-7
sql/ha_myisam.h
sql/ha_myisam.h
+1
-1
sql/opt_range.cc
sql/opt_range.cc
+2
-1
sql/sql_select.cc
sql/sql_select.cc
+26
-8
No files found.
mysql-test/r/bdb.result
View file @
1ff21a9e
...
...
@@ -1190,3 +1190,23 @@ exists (select 'two' from t1 where 'two' = outer_table.b);
b
drop table t1;
set autocommit=1;
create table t1(a int primary key, b varchar(30)) engine=bdb;
insert into t1 values (1,'one'), (2,'two'), (3,'three'), (4,'four');
create table t2 like t1;
insert t2 select * from t1;
select a from t1 where a in (select a from t2);
a
1
2
3
4
delete from t2;
insert into t2 (a, b)
select a, b from t1 where (a, b) in (select a, b from t1);
select * from t2;
a b
1 one
2 two
3 three
4 four
drop table t1, t2;
mysql-test/t/bdb.test
View file @
1ff21a9e
...
...
@@ -840,10 +840,13 @@ set autocommit=1;
# Bug #4089: subselect and open cursor.
#
#create table t1(a int primary key, b varchar(30)) engine=bdb;
#insert into t1 values (1,'one'), (2,'two'), (3,'three'), (4,'four');
#create table t2 like t1;
#insert into t2 (a, b)
# select a, b from t1 where (a, b) in (select a, b from t1);
#select * from t2;
#drop table t1, t2;
create
table
t1
(
a
int
primary
key
,
b
varchar
(
30
))
engine
=
bdb
;
insert
into
t1
values
(
1
,
'one'
),
(
2
,
'two'
),
(
3
,
'three'
),
(
4
,
'four'
);
create
table
t2
like
t1
;
insert
t2
select
*
from
t1
;
select
a
from
t1
where
a
in
(
select
a
from
t2
);
delete
from
t2
;
insert
into
t2
(
a
,
b
)
select
a
,
b
from
t1
where
(
a
,
b
)
in
(
select
a
,
b
from
t1
);
select
*
from
t2
;
drop
table
t1
,
t2
;
sql/ha_myisam.h
View file @
1ff21a9e
...
...
@@ -81,7 +81,7 @@ class ha_myisam: public handler
int
index_first
(
byte
*
buf
);
int
index_last
(
byte
*
buf
);
int
index_next_same
(
byte
*
buf
,
const
byte
*
key
,
uint
keylen
);
int
index_end
()
{
ft_handler
=
NULL
;
return
handler
::
index_end
()
;
}
int
index_end
()
{
ft_handler
=
NULL
;
return
0
;
}
int
ft_init
()
{
if
(
!
ft_handler
)
...
...
sql/opt_range.cc
View file @
1ff21a9e
...
...
@@ -413,6 +413,7 @@ QUICK_SELECT::~QUICK_SELECT()
{
if
(
!
dont_free
)
{
if
(
file
->
inited
)
file
->
ha_index_end
();
free_root
(
&
alloc
,
MYF
(
0
));
}
...
...
sql/sql_select.cc
View file @
1ff21a9e
...
...
@@ -3851,6 +3851,8 @@ JOIN::join_free(bool full)
JOIN_TAB
*
tab
,
*
end
;
DBUG_ENTER
(
"JOIN::join_free"
);
full
=
full
||
!
select_lex
->
uncacheable
;
if
(
table
)
{
/*
...
...
@@ -3862,7 +3864,18 @@ JOIN::join_free(bool full)
free_io_cache
(
table
[
const_tables
]);
filesort_free_buffers
(
table
[
const_tables
]);
}
if
(
full
||
!
select_lex
->
uncacheable
)
for
(
SELECT_LEX_UNIT
*
unit
=
select_lex
->
first_inner_unit
();
unit
;
unit
=
unit
->
next_unit
())
{
JOIN
*
join
;
for
(
SELECT_LEX
*
sl
=
unit
->
first_select_in_union
();
sl
;
sl
=
sl
->
next_select
())
if
((
join
=
sl
->
join
))
join
->
join_free
(
full
);
}
if
(
full
)
{
for
(
tab
=
join_tab
,
end
=
tab
+
tables
;
tab
!=
end
;
tab
++
)
tab
->
cleanup
();
...
...
@@ -3872,22 +3885,27 @@ JOIN::join_free(bool full)
{
for
(
tab
=
join_tab
,
end
=
tab
+
tables
;
tab
!=
end
;
tab
++
)
{
if
(
tab
->
table
&&
tab
->
table
->
file
->
inited
==
handler
::
RND
)
tab
->
table
->
file
->
ha_rnd_end
();
if
(
tab
->
table
)
tab
->
table
->
file
->
ha_
index_or_
rnd_end
();
}
}
}
/*
We are not using tables anymore
Unlock all tables. We may be in an INSERT .... SELECT statement.
*/
if
((
full
||
!
select_lex
->
uncacheable
)
&&
lock
&&
thd
->
lock
&&
!
(
select_options
&
SELECT_NO_UNLOCK
))
if
(
full
&&
lock
&&
thd
->
lock
&&
!
(
select_options
&
SELECT_NO_UNLOCK
))
{
mysql_unlock_read_tables
(
thd
,
lock
);
// Don't free join->lock
// TODO: unlock tables even if the join isn't top level select in the tree
if
(
select_lex
==
(
thd
->
lex
->
unit
.
fake_select_lex
?
thd
->
lex
->
unit
.
fake_select_lex
:
&
thd
->
lex
->
select_lex
))
{
mysql_unlock_read_tables
(
thd
,
lock
);
// Don't free join->lock
lock
=
0
;
}
}
if
(
full
)
{
group_fields
.
delete_elements
();
...
...
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