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
56f4e6b4
Commit
56f4e6b4
authored
Jan 14, 2011
by
Igor Babaev
Browse files
Options
Browse Files
Download
Plain Diff
Merge
parents
3c0a37fd
c8e56e37
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
116 additions
and
2 deletions
+116
-2
mysql-test/r/select.result
mysql-test/r/select.result
+79
-0
mysql-test/t/select.test
mysql-test/t/select.test
+33
-0
sql/sql_select.cc
sql/sql_select.cc
+4
-2
No files found.
mysql-test/r/select.result
View file @
56f4e6b4
...
...
@@ -4796,4 +4796,83 @@ SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci;
1
1
DROP TABLE t1;
#
# Bug #702310: usage of 2 join buffers after ref access to an empty table
#
CREATE TABLE t1 (f1 int) ;
INSERT INTO t1 VALUES (9);
CREATE TABLE t2 (f1 int);
INSERT INTO t2 VALUES (3),(7),(18);
INSERT INTO t2 VALUES (3),(7),(18);
INSERT INTO t2 VALUES (3),(7),(18);
INSERT INTO t2 VALUES (3),(7),(18);
CREATE TABLE t3 (f1 int);
INSERT INTO t3 VALUES (17);
CREATE TABLE t4 (f1 int PRIMARY KEY, f2 varchar(1024)) ;
CREATE TABLE t5 (f1 int) ;
INSERT INTO t5 VALUES (20),(5);
CREATE TABLE t6(f1 int);
INSERT INTO t6 VALUES (9),(7);
SET SESSION join_buffer_size = 9000;
EXPLAIN
SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1
1 SIMPLE t2 ALL NULL NULL NULL NULL 12
1 SIMPLE t3 ALL NULL NULL NULL NULL 1
1 SIMPLE t4 eq_ref PRIMARY PRIMARY 4 const 1
1 SIMPLE t5 ALL NULL NULL NULL NULL 2 Using join buffer
1 SIMPLE t6 ALL NULL NULL NULL NULL 2 Using join buffer
SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6;
f1 f1 f1 f1 f2 f1 f1
3 9 NULL NULL NULL 20 9
7 9 NULL NULL NULL 20 9
18 9 NULL NULL NULL 20 9
3 9 NULL NULL NULL 20 9
7 9 NULL NULL NULL 20 9
18 9 NULL NULL NULL 20 9
3 9 NULL NULL NULL 20 9
3 9 NULL NULL NULL 20 7
7 9 NULL NULL NULL 20 7
18 9 NULL NULL NULL 20 7
3 9 NULL NULL NULL 20 7
7 9 NULL NULL NULL 20 7
18 9 NULL NULL NULL 20 7
3 9 NULL NULL NULL 20 7
3 9 NULL NULL NULL 5 9
7 9 NULL NULL NULL 5 9
18 9 NULL NULL NULL 5 9
3 9 NULL NULL NULL 5 9
7 9 NULL NULL NULL 5 9
18 9 NULL NULL NULL 5 9
3 9 NULL NULL NULL 5 9
3 9 NULL NULL NULL 5 7
7 9 NULL NULL NULL 5 7
18 9 NULL NULL NULL 5 7
3 9 NULL NULL NULL 5 7
7 9 NULL NULL NULL 5 7
18 9 NULL NULL NULL 5 7
3 9 NULL NULL NULL 5 7
7 9 NULL NULL NULL 20 9
18 9 NULL NULL NULL 20 9
3 9 NULL NULL NULL 20 9
7 9 NULL NULL NULL 20 9
18 9 NULL NULL NULL 20 9
7 9 NULL NULL NULL 5 9
18 9 NULL NULL NULL 5 9
7 9 NULL NULL NULL 20 7
18 9 NULL NULL NULL 20 7
3 9 NULL NULL NULL 20 7
7 9 NULL NULL NULL 20 7
18 9 NULL NULL NULL 20 7
7 9 NULL NULL NULL 5 7
18 9 NULL NULL NULL 5 7
3 9 NULL NULL NULL 5 9
7 9 NULL NULL NULL 5 9
18 9 NULL NULL NULL 5 9
3 9 NULL NULL NULL 5 7
7 9 NULL NULL NULL 5 7
18 9 NULL NULL NULL 5 7
SET SESSION join_buffer_size = DEFAULT;
DROP TABLE t1,t2,t3,t4,t5,t6;
End of 5.1 tests
mysql-test/t/select.test
View file @
56f4e6b4
...
...
@@ -4087,5 +4087,38 @@ EXPLAIN SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci;
SELECT
1
FROM
t1
ORDER
BY
a
COLLATE
latin1_german2_ci
;
DROP
TABLE
t1
;
--
echo
#
--
echo
# Bug #702310: usage of 2 join buffers after ref access to an empty table
--
echo
#
CREATE
TABLE
t1
(
f1
int
)
;
INSERT
INTO
t1
VALUES
(
9
);
CREATE
TABLE
t2
(
f1
int
);
INSERT
INTO
t2
VALUES
(
3
),(
7
),(
18
);
INSERT
INTO
t2
VALUES
(
3
),(
7
),(
18
);
INSERT
INTO
t2
VALUES
(
3
),(
7
),(
18
);
INSERT
INTO
t2
VALUES
(
3
),(
7
),(
18
);
CREATE
TABLE
t3
(
f1
int
);
INSERT
INTO
t3
VALUES
(
17
);
CREATE
TABLE
t4
(
f1
int
PRIMARY
KEY
,
f2
varchar
(
1024
))
;
CREATE
TABLE
t5
(
f1
int
)
;
INSERT
INTO
t5
VALUES
(
20
),(
5
);
CREATE
TABLE
t6
(
f1
int
);
INSERT
INTO
t6
VALUES
(
9
),(
7
);
SET
SESSION
join_buffer_size
=
9000
;
EXPLAIN
SELECT
STRAIGHT_JOIN
*
FROM
t2
,
(
t1
LEFT
JOIN
(
t3
,
t4
)
ON
t1
.
f1
=
t4
.
f1
),
t5
,
t6
;
SELECT
STRAIGHT_JOIN
*
FROM
t2
,
(
t1
LEFT
JOIN
(
t3
,
t4
)
ON
t1
.
f1
=
t4
.
f1
),
t5
,
t6
;
SET
SESSION
join_buffer_size
=
DEFAULT
;
DROP
TABLE
t1
,
t2
,
t3
,
t4
,
t5
,
t6
;
--
echo
End
of
5.1
tests
sql/sql_select.cc
View file @
56f4e6b4
...
...
@@ -11957,7 +11957,8 @@ flush_cached_records(JOIN *join,JOIN_TAB *join_tab,bool skip_last)
return
error
<
0
?
NESTED_LOOP_NO_MORE_ROWS
:
NESTED_LOOP_ERROR
;
}
for
(
JOIN_TAB
*
tmp
=
join
->
join_tab
;
tmp
!=
join_tab
;
tmp
++
)
for
(
JOIN_TAB
*
tmp
=
join_tab
-
1
;
tmp
>=
join
->
join_tab
&&
!
tmp
->
cache
.
buff
;
tmp
--
)
{
tmp
->
status
=
tmp
->
table
->
status
;
tmp
->
table
->
status
=
0
;
...
...
@@ -12015,7 +12016,8 @@ flush_cached_records(JOIN *join,JOIN_TAB *join_tab,bool skip_last)
reset_cache_write
(
&
join_tab
->
cache
);
if
(
error
>
0
)
// Fatal error
return
NESTED_LOOP_ERROR
;
/* purecov: inspected */
for
(
JOIN_TAB
*
tmp2
=
join
->
join_tab
;
tmp2
!=
join_tab
;
tmp2
++
)
for
(
JOIN_TAB
*
tmp2
=
join_tab
-
1
;
tmp2
>=
join
->
join_tab
&&
!
tmp2
->
cache
.
buff
;
tmp2
--
)
tmp2
->
table
->
status
=
tmp2
->
status
;
return
NESTED_LOOP_OK
;
}
...
...
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