Loading mysql-test/r/order_by.result +16 −0 Original line number Diff line number Diff line Loading @@ -1428,6 +1428,22 @@ set session max_sort_length= 2180; select * from t1 order by b; ERROR HY001: Out of sort memory; increase server sort buffer size drop table t1; # # Bug #39844: Query Crash Mysql Server 5.0.67 # CREATE TABLE t1 (a INT PRIMARY KEY); CREATE TABLE t2 (a INT PRIMARY KEY, b INT); CREATE TABLE t3 (c INT); INSERT INTO t1 (a) VALUES (1), (2); INSERT INTO t2 (a,b) VALUES (1,2), (2,3); INSERT INTO t3 (c) VALUES (1), (2); SELECT (SELECT t1.a FROM t1, t2 WHERE t1.a = t2.b AND t2.a = t3.c ORDER BY t1.a) FROM t3; (SELECT t1.a FROM t1, t2 WHERE t1.a = t2.b AND t2.a = t3.c ORDER BY t1.a) 2 NULL DROP TABLE t1, t2, t3; CREATE TABLE t2 (a varchar(32), b int(11), c float, d double, UNIQUE KEY a (a,b,c), KEY b (b), KEY c (c)); CREATE TABLE t1 (a varchar(32), b char(3), UNIQUE KEY a (a,b), KEY b (b)); Loading mysql-test/t/order_by.test +20 −0 Original line number Diff line number Diff line Loading @@ -847,6 +847,26 @@ set session max_sort_length= 2180; select * from t1 order by b; drop table t1; --echo # --echo # Bug #39844: Query Crash Mysql Server 5.0.67 --echo # CREATE TABLE t1 (a INT PRIMARY KEY); CREATE TABLE t2 (a INT PRIMARY KEY, b INT); CREATE TABLE t3 (c INT); INSERT INTO t1 (a) VALUES (1), (2); INSERT INTO t2 (a,b) VALUES (1,2), (2,3); INSERT INTO t3 (c) VALUES (1), (2); SELECT (SELECT t1.a FROM t1, t2 WHERE t1.a = t2.b AND t2.a = t3.c ORDER BY t1.a) FROM t3; DROP TABLE t1, t2, t3; # # Bug #35206: select query result different if the key is indexed or not # Loading sql/sql_select.cc +1 −0 Original line number Diff line number Diff line Loading @@ -6863,6 +6863,7 @@ only_eq_ref_tables(JOIN *join,ORDER *order,table_map tables) { if (specialflag & SPECIAL_SAFE_MODE) return 0; // skip this optimize /* purecov: inspected */ tables&= ~PSEUDO_TABLE_BITS; for (JOIN_TAB **tab=join->map2table ; tables ; tab++, tables>>=1) { if (tables & 1 && !eq_ref_table(join, order, *tab)) Loading Loading
mysql-test/r/order_by.result +16 −0 Original line number Diff line number Diff line Loading @@ -1428,6 +1428,22 @@ set session max_sort_length= 2180; select * from t1 order by b; ERROR HY001: Out of sort memory; increase server sort buffer size drop table t1; # # Bug #39844: Query Crash Mysql Server 5.0.67 # CREATE TABLE t1 (a INT PRIMARY KEY); CREATE TABLE t2 (a INT PRIMARY KEY, b INT); CREATE TABLE t3 (c INT); INSERT INTO t1 (a) VALUES (1), (2); INSERT INTO t2 (a,b) VALUES (1,2), (2,3); INSERT INTO t3 (c) VALUES (1), (2); SELECT (SELECT t1.a FROM t1, t2 WHERE t1.a = t2.b AND t2.a = t3.c ORDER BY t1.a) FROM t3; (SELECT t1.a FROM t1, t2 WHERE t1.a = t2.b AND t2.a = t3.c ORDER BY t1.a) 2 NULL DROP TABLE t1, t2, t3; CREATE TABLE t2 (a varchar(32), b int(11), c float, d double, UNIQUE KEY a (a,b,c), KEY b (b), KEY c (c)); CREATE TABLE t1 (a varchar(32), b char(3), UNIQUE KEY a (a,b), KEY b (b)); Loading
mysql-test/t/order_by.test +20 −0 Original line number Diff line number Diff line Loading @@ -847,6 +847,26 @@ set session max_sort_length= 2180; select * from t1 order by b; drop table t1; --echo # --echo # Bug #39844: Query Crash Mysql Server 5.0.67 --echo # CREATE TABLE t1 (a INT PRIMARY KEY); CREATE TABLE t2 (a INT PRIMARY KEY, b INT); CREATE TABLE t3 (c INT); INSERT INTO t1 (a) VALUES (1), (2); INSERT INTO t2 (a,b) VALUES (1,2), (2,3); INSERT INTO t3 (c) VALUES (1), (2); SELECT (SELECT t1.a FROM t1, t2 WHERE t1.a = t2.b AND t2.a = t3.c ORDER BY t1.a) FROM t3; DROP TABLE t1, t2, t3; # # Bug #35206: select query result different if the key is indexed or not # Loading
sql/sql_select.cc +1 −0 Original line number Diff line number Diff line Loading @@ -6863,6 +6863,7 @@ only_eq_ref_tables(JOIN *join,ORDER *order,table_map tables) { if (specialflag & SPECIAL_SAFE_MODE) return 0; // skip this optimize /* purecov: inspected */ tables&= ~PSEUDO_TABLE_BITS; for (JOIN_TAB **tab=join->map2table ; tables ; tab++, tables>>=1) { if (tables & 1 && !eq_ref_table(join, order, *tab)) Loading