Commit 2256ecdd authored by Sergey Petrunya's avatar Sergey Petrunya

Merge 5.2->5.3

parents d2064806 0919edf3
...@@ -1275,6 +1275,55 @@ Handler_read_rnd_next 1 ...@@ -1275,6 +1275,55 @@ Handler_read_rnd_next 1
DROP TABLE t1, t2; DROP TABLE t1, t2;
End of 5.1 tests 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 # BUG#724275: Crash in JOIN::optimize in maria-5.3
# #
create table t1 (a int); create table t1 (a int);
......
...@@ -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 ...@@ -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; GROUP BY 1;
a a
DROP TABLE t1,t2; 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;
...@@ -4821,10 +4821,10 @@ SET SESSION join_buffer_size = 2048; ...@@ -4821,10 +4821,10 @@ SET SESSION join_buffer_size = 2048;
EXPLAIN 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;
id select_type table type possible_keys key key_len ref rows Extra 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 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 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 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) 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; SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6;
......
...@@ -4832,10 +4832,10 @@ SET SESSION join_buffer_size = 2048; ...@@ -4832,10 +4832,10 @@ SET SESSION join_buffer_size = 2048;
EXPLAIN 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;
id select_type table type possible_keys key key_len ref rows Extra 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 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 t1 ALL NULL NULL NULL NULL 1 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 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 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) 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; SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6;
......
...@@ -4821,10 +4821,10 @@ SET SESSION join_buffer_size = 2048; ...@@ -4821,10 +4821,10 @@ SET SESSION join_buffer_size = 2048;
EXPLAIN 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;
id select_type table type possible_keys key key_len ref rows Extra 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 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 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 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) 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; SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6;
......
...@@ -621,3 +621,27 @@ ERROR 23000: Duplicate entry '2' for key 'a' ...@@ -621,3 +621,27 @@ ERROR 23000: Duplicate entry '2' for key 'a'
insert into t1 values(3); insert into t1 values(3);
insert into t2 values(3); insert into t2 values(3);
drop table t1, t2; 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;
...@@ -524,6 +524,37 @@ insert into t2 values(3); ...@@ -524,6 +524,37 @@ insert into t2 values(3);
connection default; connection default;
drop table t1, t2; 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 # End of 5.1 tests
--disable_result_log --disable_result_log
......
...@@ -941,7 +941,6 @@ SELECT f1 , MIN(f2) FROM v2 GROUP BY f1; ...@@ -941,7 +941,6 @@ SELECT f1 , MIN(f2) FROM v2 GROUP BY f1;
drop table t1,t2; drop table t1,t2;
drop view v1,v2; drop view v1,v2;
--echo # --echo #
--echo # BUG#47217 Lost optimization caused slowdown & wrong result. --echo # BUG#47217 Lost optimization caused slowdown & wrong result.
--echo # --echo #
...@@ -963,6 +962,46 @@ DROP TABLE t1, t2; ...@@ -963,6 +962,46 @@ DROP TABLE t1, t2;
--echo End of 5.1 tests --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 #
--echo # BUG#724275: Crash in JOIN::optimize in maria-5.3 --echo # BUG#724275: Crash in JOIN::optimize in maria-5.3
--echo # --echo #
......
...@@ -39,3 +39,70 @@ SELECT STRAIGHT_JOIN t1.a FROM t1 RIGHT JOIN t2 ON t1.b = t2.b ...@@ -39,3 +39,70 @@ SELECT STRAIGHT_JOIN t1.a FROM t1 RIGHT JOIN t2 ON t1.b = t2.b
GROUP BY 1; GROUP BY 1;
DROP TABLE t1,t2; 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;
...@@ -12274,6 +12274,7 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top, ...@@ -12274,6 +12274,7 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top,
tbl->table->maybe_null= FALSE; tbl->table->maybe_null= FALSE;
tbl->join_list= table->join_list; tbl->join_list= table->join_list;
repl_list.push_back(tbl); repl_list.push_back(tbl);
tbl->dep_tables|= table->dep_tables;
} }
li.replace(repl_list); li.replace(repl_list);
/* Need to update the name resolution table chain when flattening joins */ /* Need to update the name resolution table chain when flattening joins */
......
...@@ -1714,9 +1714,11 @@ my_bool _ma_columndef_write(File file, MARIA_COLUMNDEF *columndef) ...@@ -1714,9 +1714,11 @@ my_bool _ma_columndef_write(File file, MARIA_COLUMNDEF *columndef)
{ {
uchar buff[MARIA_COLUMNDEF_SIZE]; uchar buff[MARIA_COLUMNDEF_SIZE];
uchar *ptr=buff; 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->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->type); ptr+= 2;
mi_int2store(ptr,columndef->length); ptr+= 2; mi_int2store(ptr,columndef->length); ptr+= 2;
mi_int2store(ptr,columndef->fill_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) ...@@ -1725,12 +1727,14 @@ my_bool _ma_columndef_write(File file, MARIA_COLUMNDEF *columndef)
(*ptr++)= columndef->null_bit; (*ptr++)= columndef->null_bit;
(*ptr++)= columndef->empty_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; return my_write(file, buff, (size_t) (ptr-buff), MYF(MY_NABP)) != 0;
} }
uchar *_ma_columndef_read(uchar *ptr, MARIA_COLUMNDEF *columndef) uchar *_ma_columndef_read(uchar *ptr, MARIA_COLUMNDEF *columndef)
{ {
uint high_offset;
columndef->column_nr= mi_uint2korr(ptr); ptr+= 2; columndef->column_nr= mi_uint2korr(ptr); ptr+= 2;
columndef->offset= mi_uint2korr(ptr); ptr+= 2; columndef->offset= mi_uint2korr(ptr); ptr+= 2;
columndef->type= mi_sint2korr(ptr); ptr+= 2; columndef->type= mi_sint2korr(ptr); ptr+= 2;
...@@ -1740,7 +1744,9 @@ uchar *_ma_columndef_read(uchar *ptr, MARIA_COLUMNDEF *columndef) ...@@ -1740,7 +1744,9 @@ uchar *_ma_columndef_read(uchar *ptr, MARIA_COLUMNDEF *columndef)
columndef->empty_pos= mi_uint2korr(ptr); ptr+= 2; columndef->empty_pos= mi_uint2korr(ptr); ptr+= 2;
columndef->null_bit= (uint8) *ptr++; columndef->null_bit= (uint8) *ptr++;
columndef->empty_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; return ptr;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment