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
2256ecdd
Commit
2256ecdd
authored
Feb 24, 2012
by
Sergey Petrunya
Browse files
Options
Browse Files
Download
Plain Diff
Merge 5.2->5.3
parents
d2064806
0919edf3
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
355 additions
and
11 deletions
+355
-11
mysql-test/r/join.result
mysql-test/r/join.result
+49
-0
mysql-test/r/join_outer_innodb.result
mysql-test/r/join_outer_innodb.result
+127
-0
mysql-test/r/select.result
mysql-test/r/select.result
+2
-2
mysql-test/r/select_jcl6.result
mysql-test/r/select_jcl6.result
+3
-3
mysql-test/r/select_pkeycache.result
mysql-test/r/select_pkeycache.result
+2
-2
mysql-test/suite/maria/r/maria3.result
mysql-test/suite/maria/r/maria3.result
+24
-0
mysql-test/suite/maria/t/maria3.test
mysql-test/suite/maria/t/maria3.test
+31
-0
mysql-test/t/join.test
mysql-test/t/join.test
+40
-1
mysql-test/t/join_outer_innodb.test
mysql-test/t/join_outer_innodb.test
+67
-0
sql/sql_select.cc
sql/sql_select.cc
+1
-0
storage/maria/ma_open.c
storage/maria/ma_open.c
+9
-3
No files found.
mysql-test/r/join.result
View file @
2256ecdd
...
...
@@ -1275,6 +1275,55 @@ Handler_read_rnd_next 1
DROP TABLE t1, t2;
End of 5.1 tests
#
# Bug #43368: STRAIGHT_JOIN DOESN'T WORK FOR NESTED JOINS
#
create table t1(c1 int primary key, c2 char(10)) engine=myisam;
create table t2(c1 int primary key, c2 char(10), ref_t1 int) engine=myisam;
create table t3(c1 int primary key, c2 char(10), ref_t1 int) engine=myisam;
create table t4(c1 int primary key, c2 char(10), ref_t1 int) engine=myisam;
insert into t1 values(1,'a');
insert into t2 values(1,'a', 1);
insert into t3 values(1,'a', 1);
insert into t3 values(2,'b',2);
insert into t4 values(1,'a', 1);
insert into t4 values(2,'a', 2);
insert into t4 values(3,'a', 3);
insert into t4 values(4,'a', 4);
insert into t1 values(2,'b');
insert into t1 values(3,'c');
EXPLAIN
SELECT *
FROM t4 JOIN
(t1 JOIN t3 ON t3.ref_t1=t1.c1 JOIN t2 ON t2.ref_t1=t1.c1)
ON t4.ref_t1=t1.c1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 system NULL NULL NULL NULL 1
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 Using where
1 SIMPLE t4 ALL NULL NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join)
EXPLAIN
SELECT STRAIGHT_JOIN *
FROM t4 JOIN
(t1 JOIN t3 ON t3.ref_t1=t1.c1 JOIN t2 ON t2.ref_t1=t1.c1)
ON t4.ref_t1=t1.c1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 ALL NULL NULL NULL NULL 4
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join)
1 SIMPLE t2 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join)
EXPLAIN
SELECT *
FROM t4 STRAIGHT_JOIN
(t1 JOIN t3 ON t3.ref_t1=t1.c1 JOIN t2 ON t2.ref_t1=t1.c1)
ON t4.ref_t1=t1.c1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 ALL NULL NULL NULL NULL 4 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t4.ref_t1 1
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
drop table t1,t2,t3,t4;
End of 5.2 tests
#
# BUG#724275: Crash in JOIN::optimize in maria-5.3
#
create table t1 (a int);
...
...
mysql-test/r/join_outer_innodb.result
View file @
2256ecdd
...
...
@@ -25,3 +25,130 @@ WHERE (t1.b NOT BETWEEN 1 AND 7 OR t1.a IS NULL AND t1.b = t2.b) AND t2.b = 4
GROUP BY 1;
a
DROP TABLE t1,t2;
#
Bug #59487: WRONG RESULT WITH STRAIGHT_JOIN AND RIGHT JOIN
#
CREATE TABLE t1 (
pk int(11) NOT NULL,
col_varchar_10_latin1_key varchar(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO t1 VALUES (1,'1');
CREATE TABLE t2 (
pk int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO t2 VALUES (1);
CREATE TABLE t3 (
pk int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO t3 VALUES (1);
CREATE TABLE t4 (
pk int(11) NOT NULL,
col_int int(11) DEFAULT NULL,
col_int_key int(11) DEFAULT NULL,
col_varchar_10_latin1_key varchar(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO t4 VALUES (1,1,1,'1');
CREATE TABLE t5 (
col_int int(11) DEFAULT NULL,
col_varchar_10_utf8_key varchar(10) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO t5 VALUES (1,'1');
CREATE TABLE t6 (
col_int_key int(11) DEFAULT NULL,
col_varchar_10_latin1_key varchar(10) DEFAULT NULL,
pk int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO t6 VALUES (1,'1',1);
SELECT STRAIGHT_JOIN t6a.pk, t2.pk
FROM t6 AS t6a
LEFT JOIN
(
t2
RIGHT JOIN
(
(t1 LEFT JOIN (t4 JOIN t3 ON t4.col_int) ON t4.col_int_key = t1.pk)
LEFT JOIN
(t5 JOIN t6 AS t6b
ON t5.col_varchar_10_utf8_key = t6b.col_varchar_10_latin1_key)
ON t1.pk = t5.col_int
)
ON t4.col_varchar_10_latin1_key = t1.col_varchar_10_latin1_key
AND t5.col_varchar_10_utf8_key = 0
)
ON t6a.pk IS TRUE
WHERE t6b.col_int_key IS TRUE;
pk pk
1 NULL
EXPLAIN SELECT STRAIGHT_JOIN t6a.pk, t2.pk
FROM t6 AS t6a
LEFT JOIN
(
t2
RIGHT JOIN
(
(t1 LEFT JOIN (t4 JOIN t3 ON t4.col_int) ON t4.col_int_key = t1.pk)
LEFT JOIN
(t5 JOIN t6 AS t6b
ON t5.col_varchar_10_utf8_key = t6b.col_varchar_10_latin1_key)
ON t1.pk = t5.col_int
)
ON t4.col_varchar_10_latin1_key = t1.col_varchar_10_latin1_key
AND t5.col_varchar_10_utf8_key = 0
)
ON t6a.pk IS TRUE
WHERE t6b.col_int_key IS TRUE;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t6a ALL NULL NULL NULL NULL 1 Using where
1 SIMPLE t1 ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join)
1 SIMPLE t4 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join)
1 SIMPLE t3 ALL NULL NULL NULL NULL 1 Using join buffer (incremental, BNL join)
1 SIMPLE t5 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join)
1 SIMPLE t6b ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join)
1 SIMPLE t2 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join)
SELECT t6a.pk, t2.pk
FROM t6 AS t6a
LEFT JOIN
(
t2
RIGHT JOIN
(
(t1 LEFT JOIN (t4 JOIN t3 ON t4.col_int) ON t4.col_int_key = t1.pk)
LEFT JOIN
(t5 JOIN t6 AS t6b
ON t5.col_varchar_10_utf8_key = t6b.col_varchar_10_latin1_key)
ON t1.pk = t5.col_int
)
ON t4.col_varchar_10_latin1_key = t1.col_varchar_10_latin1_key
AND t5.col_varchar_10_utf8_key = 0
)
ON t6a.pk IS TRUE
WHERE t6b.col_int_key IS TRUE;
pk pk
1 NULL
EXPLAIN SELECT t6a.pk, t2.pk
FROM t6 AS t6a
LEFT JOIN
(
t2
RIGHT JOIN
(
(t1 LEFT JOIN (t4 JOIN t3 ON t4.col_int) ON t4.col_int_key = t1.pk)
LEFT JOIN
(t5 JOIN t6 AS t6b
ON t5.col_varchar_10_utf8_key = t6b.col_varchar_10_latin1_key)
ON t1.pk = t5.col_int
)
ON t4.col_varchar_10_latin1_key = t1.col_varchar_10_latin1_key
AND t5.col_varchar_10_utf8_key = 0
)
ON t6a.pk IS TRUE
WHERE t6b.col_int_key IS TRUE;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t6a ALL NULL NULL NULL NULL 1 Using where
1 SIMPLE t1 ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join)
1 SIMPLE t4 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join)
1 SIMPLE t3 ALL NULL NULL NULL NULL 1 Using join buffer (incremental, BNL join)
1 SIMPLE t5 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join)
1 SIMPLE t2 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join)
1 SIMPLE t6b ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join)
drop table t1,t2,t3,t4,t5,t6;
mysql-test/r/select.result
View file @
2256ecdd
...
...
@@ -4821,10 +4821,10 @@ SET SESSION join_buffer_size = 2048;
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 t1 ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join)
1 SIMPLE t3 ALL NULL NULL NULL NULL 1 Using where
1 SIMPLE t4 eq_ref PRIMARY PRIMARY 4
const
1
1 SIMPLE t4 eq_ref PRIMARY PRIMARY 4
test.t1.f1
1
1 SIMPLE t5 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
1 SIMPLE t6 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6;
...
...
mysql-test/r/select_jcl6.result
View file @
2256ecdd
...
...
@@ -4832,10 +4832,10 @@ SET SESSION join_buffer_size = 2048;
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 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t4 eq_ref PRIMARY PRIMARY 4 const 1 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
1 SIMPLE t1 ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join)
1 SIMPLE t3 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join)
1 SIMPLE t4 eq_ref PRIMARY PRIMARY 4 test.t1.f1 1 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
1 SIMPLE t5 ALL NULL NULL NULL NULL 2 Using join buffer (incremental, BNL join)
1 SIMPLE t6 ALL NULL NULL NULL NULL 2 Using join buffer (incremental, BNL join)
SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6;
...
...
mysql-test/r/select_pkeycache.result
View file @
2256ecdd
...
...
@@ -4821,10 +4821,10 @@ SET SESSION join_buffer_size = 2048;
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 t1 ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join)
1 SIMPLE t3 ALL NULL NULL NULL NULL 1 Using where
1 SIMPLE t4 eq_ref PRIMARY PRIMARY 4
const
1
1 SIMPLE t4 eq_ref PRIMARY PRIMARY 4
test.t1.f1
1
1 SIMPLE t5 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
1 SIMPLE t6 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6;
...
...
mysql-test/suite/maria/r/maria3.result
View file @
2256ecdd
...
...
@@ -621,3 +621,27 @@ ERROR 23000: Duplicate entry '2' for key 'a'
insert into t1 values(3);
insert into t2 values(3);
drop table t1, t2;
CREATE TABLE t1 (
a INT PRIMARY KEY,
b CHAR(255),
c VARCHAR(2048),
d VARCHAR(18990),
e CHAR(128),
f CHAR(192)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO t1 VALUES
(1,'A','B','C','','D'),
(2,'Abcdefghi','E','F','','G');
CREATE TABLE t2 (
g INT PRIMARY KEY,
h CHAR(32),
i CHAR(255),
j TEXT
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO t2 VALUES (1,'M','','H'),
(2,'N','','H');
SELECT * FROM t1, t2 WHERE a = g ORDER BY b;
a b c d e f g h i j
1 A B C D 1 M H
2 Abcdefghi E F G 2 N H
drop table t1,t2;
mysql-test/suite/maria/t/maria3.test
View file @
2256ecdd
...
...
@@ -524,6 +524,37 @@ insert into t2 values(3);
connection
default
;
drop
table
t1
,
t2
;
#
# BUG#909635 - MariaDB crashes on a select with long varchar and blob fields
#
CREATE
TABLE
t1
(
a
INT
PRIMARY
KEY
,
b
CHAR
(
255
),
c
VARCHAR
(
2048
),
d
VARCHAR
(
18990
),
e
CHAR
(
128
),
f
CHAR
(
192
)
)
ENGINE
=
MyISAM
DEFAULT
CHARSET
=
utf8
;
INSERT
INTO
t1
VALUES
(
1
,
'A'
,
'B'
,
'C'
,
''
,
'D'
),
(
2
,
'Abcdefghi'
,
'E'
,
'F'
,
''
,
'G'
);
CREATE
TABLE
t2
(
g
INT
PRIMARY
KEY
,
h
CHAR
(
32
),
i
CHAR
(
255
),
j
TEXT
)
ENGINE
=
MyISAM
DEFAULT
CHARSET
=
utf8
;
INSERT
INTO
t2
VALUES
(
1
,
'M'
,
''
,
'H'
),
(
2
,
'N'
,
''
,
'H'
);
SELECT
*
FROM
t1
,
t2
WHERE
a
=
g
ORDER
BY
b
;
drop
table
t1
,
t2
;
# End of 5.1 tests
--
disable_result_log
...
...
mysql-test/t/join.test
View file @
2256ecdd
...
...
@@ -941,7 +941,6 @@ SELECT f1 , MIN(f2) FROM v2 GROUP BY f1;
drop
table
t1
,
t2
;
drop
view
v1
,
v2
;
--
echo
#
--
echo
# BUG#47217 Lost optimization caused slowdown & wrong result.
--
echo
#
...
...
@@ -963,6 +962,46 @@ DROP TABLE t1, t2;
--
echo
End
of
5.1
tests
--
echo
#
--
echo
# Bug #43368: STRAIGHT_JOIN DOESN'T WORK FOR NESTED JOINS
--
echo
#
create
table
t1
(
c1
int
primary
key
,
c2
char
(
10
))
engine
=
myisam
;
create
table
t2
(
c1
int
primary
key
,
c2
char
(
10
),
ref_t1
int
)
engine
=
myisam
;
create
table
t3
(
c1
int
primary
key
,
c2
char
(
10
),
ref_t1
int
)
engine
=
myisam
;
create
table
t4
(
c1
int
primary
key
,
c2
char
(
10
),
ref_t1
int
)
engine
=
myisam
;
insert
into
t1
values
(
1
,
'a'
);
insert
into
t2
values
(
1
,
'a'
,
1
);
insert
into
t3
values
(
1
,
'a'
,
1
);
insert
into
t3
values
(
2
,
'b'
,
2
);
insert
into
t4
values
(
1
,
'a'
,
1
);
insert
into
t4
values
(
2
,
'a'
,
2
);
insert
into
t4
values
(
3
,
'a'
,
3
);
insert
into
t4
values
(
4
,
'a'
,
4
);
insert
into
t1
values
(
2
,
'b'
);
insert
into
t1
values
(
3
,
'c'
);
EXPLAIN
SELECT
*
FROM
t4
JOIN
(
t1
JOIN
t3
ON
t3
.
ref_t1
=
t1
.
c1
JOIN
t2
ON
t2
.
ref_t1
=
t1
.
c1
)
ON
t4
.
ref_t1
=
t1
.
c1
;
EXPLAIN
SELECT
STRAIGHT_JOIN
*
FROM
t4
JOIN
(
t1
JOIN
t3
ON
t3
.
ref_t1
=
t1
.
c1
JOIN
t2
ON
t2
.
ref_t1
=
t1
.
c1
)
ON
t4
.
ref_t1
=
t1
.
c1
;
EXPLAIN
SELECT
*
FROM
t4
STRAIGHT_JOIN
(
t1
JOIN
t3
ON
t3
.
ref_t1
=
t1
.
c1
JOIN
t2
ON
t2
.
ref_t1
=
t1
.
c1
)
ON
t4
.
ref_t1
=
t1
.
c1
;
drop
table
t1
,
t2
,
t3
,
t4
;
--
echo
End
of
5.2
tests
--
echo
#
--
echo
# BUG#724275: Crash in JOIN::optimize in maria-5.3
--
echo
#
...
...
mysql-test/t/join_outer_innodb.test
View file @
2256ecdd
...
...
@@ -39,3 +39,70 @@ SELECT STRAIGHT_JOIN t1.a FROM t1 RIGHT JOIN t2 ON t1.b = t2.b
GROUP
BY
1
;
DROP
TABLE
t1
,
t2
;
--
echo
#
--
echo
Bug
#59487: WRONG RESULT WITH STRAIGHT_JOIN AND RIGHT JOIN
--
echo
#
CREATE
TABLE
t1
(
pk
int
(
11
)
NOT
NULL
,
col_varchar_10_latin1_key
varchar
(
10
)
DEFAULT
NULL
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
latin1
;
INSERT
INTO
t1
VALUES
(
1
,
'1'
);
CREATE
TABLE
t2
(
pk
int
(
11
)
NOT
NULL
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
latin1
;
INSERT
INTO
t2
VALUES
(
1
);
CREATE
TABLE
t3
(
pk
int
(
11
)
NOT
NULL
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
latin1
;
INSERT
INTO
t3
VALUES
(
1
);
CREATE
TABLE
t4
(
pk
int
(
11
)
NOT
NULL
,
col_int
int
(
11
)
DEFAULT
NULL
,
col_int_key
int
(
11
)
DEFAULT
NULL
,
col_varchar_10_latin1_key
varchar
(
10
)
DEFAULT
NULL
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
latin1
;
INSERT
INTO
t4
VALUES
(
1
,
1
,
1
,
'1'
);
CREATE
TABLE
t5
(
col_int
int
(
11
)
DEFAULT
NULL
,
col_varchar_10_utf8_key
varchar
(
10
)
CHARACTER
SET
utf8
DEFAULT
NULL
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
latin1
;
INSERT
INTO
t5
VALUES
(
1
,
'1'
);
CREATE
TABLE
t6
(
col_int_key
int
(
11
)
DEFAULT
NULL
,
col_varchar_10_latin1_key
varchar
(
10
)
DEFAULT
NULL
,
pk
int
(
11
)
NOT
NULL
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
latin1
;
INSERT
INTO
t6
VALUES
(
1
,
'1'
,
1
);
# EXPLAIN of query above (t2 is before t5 in plan)
let
$rest_of_query
=
t6a
.
pk
,
t2
.
pk
FROM
t6
AS
t6a
LEFT
JOIN
(
t2
RIGHT
JOIN
(
(
t1
LEFT
JOIN
(
t4
JOIN
t3
ON
t4
.
col_int
)
ON
t4
.
col_int_key
=
t1
.
pk
)
LEFT
JOIN
(
t5
JOIN
t6
AS
t6b
ON
t5
.
col_varchar_10_utf8_key
=
t6b
.
col_varchar_10_latin1_key
)
ON
t1
.
pk
=
t5
.
col_int
)
ON
t4
.
col_varchar_10_latin1_key
=
t1
.
col_varchar_10_latin1_key
AND
t5
.
col_varchar_10_utf8_key
=
0
)
ON
t6a
.
pk
IS
TRUE
WHERE
t6b
.
col_int_key
IS
TRUE
;
eval
SELECT
STRAIGHT_JOIN
$rest_of_query
;
eval
EXPLAIN
SELECT
STRAIGHT_JOIN
$rest_of_query
;
# right result (same query, just remove STRAIGHT_JOIN):
eval
SELECT
$rest_of_query
;
eval
EXPLAIN
SELECT
$rest_of_query
;
drop
table
t1
,
t2
,
t3
,
t4
,
t5
,
t6
;
sql/sql_select.cc
View file @
2256ecdd
...
...
@@ -12274,6 +12274,7 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top,
tbl
->
table
->
maybe_null
=
FALSE
;
tbl
->
join_list
=
table
->
join_list
;
repl_list
.
push_back
(
tbl
);
tbl
->
dep_tables
|=
table
->
dep_tables
;
}
li
.
replace
(
repl_list
);
/* Need to update the name resolution table chain when flattening joins */
...
...
storage/maria/ma_open.c
View file @
2256ecdd
...
...
@@ -1714,9 +1714,11 @@ my_bool _ma_columndef_write(File file, MARIA_COLUMNDEF *columndef)
{
uchar
buff
[
MARIA_COLUMNDEF_SIZE
];
uchar
*
ptr
=
buff
;
uint
low_offset
=
(
uint
)
(
columndef
->
offset
&
0xffff
);
uint
high_offset
=
(
uint
)
(
columndef
->
offset
>>
16
);
mi_int2store
(
ptr
,(
ulong
)
columndef
->
column_nr
);
ptr
+=
2
;
mi_int2store
(
ptr
,
(
ulong
)
columndef
->
offset
);
ptr
+=
2
;
mi_int2store
(
ptr
,
low_offset
);
ptr
+=
2
;
mi_int2store
(
ptr
,
columndef
->
type
);
ptr
+=
2
;
mi_int2store
(
ptr
,
columndef
->
length
);
ptr
+=
2
;
mi_int2store
(
ptr
,
columndef
->
fill_length
);
ptr
+=
2
;
...
...
@@ -1725,12 +1727,14 @@ my_bool _ma_columndef_write(File file, MARIA_COLUMNDEF *columndef)
(
*
ptr
++
)
=
columndef
->
null_bit
;
(
*
ptr
++
)
=
columndef
->
empty_bit
;
ptr
[
0
]
=
ptr
[
1
]
=
ptr
[
2
]
=
ptr
[
3
]
=
0
;
ptr
+=
4
;
/* For future */
mi_int2store
(
ptr
,
high_offset
);
ptr
+=
2
;
ptr
[
0
]
=
ptr
[
1
]
=
0
;
ptr
+=
2
;
/* For future */
return
my_write
(
file
,
buff
,
(
size_t
)
(
ptr
-
buff
),
MYF
(
MY_NABP
))
!=
0
;
}
uchar
*
_ma_columndef_read
(
uchar
*
ptr
,
MARIA_COLUMNDEF
*
columndef
)
{
uint
high_offset
;
columndef
->
column_nr
=
mi_uint2korr
(
ptr
);
ptr
+=
2
;
columndef
->
offset
=
mi_uint2korr
(
ptr
);
ptr
+=
2
;
columndef
->
type
=
mi_sint2korr
(
ptr
);
ptr
+=
2
;
...
...
@@ -1740,7 +1744,9 @@ uchar *_ma_columndef_read(uchar *ptr, MARIA_COLUMNDEF *columndef)
columndef
->
empty_pos
=
mi_uint2korr
(
ptr
);
ptr
+=
2
;
columndef
->
null_bit
=
(
uint8
)
*
ptr
++
;
columndef
->
empty_bit
=
(
uint8
)
*
ptr
++
;
ptr
+=
4
;
high_offset
=
mi_uint2korr
(
ptr
);
ptr
+=
2
;
columndef
->
offset
|=
((
ulong
)
high_offset
<<
16
);
ptr
+=
2
;
return
ptr
;
}
...
...
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