diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result index e1e823350d3..e335e316170 100644 --- a/mysql-test/r/derived.result +++ b/mysql-test/r/derived.result @@ -146,3 +146,5 @@ SELECT 1 as a FROM (SELECT a UNION SELECT 1) b; Unknown column 'a' in 'field list' SELECT 1 as a FROM (SELECT 1 UNION SELECT a) b; Unknown column 'a' in 'field list' +select 1 from (select 2) a order by 0; +Unknown column '0' in 'order clause' diff --git a/mysql-test/r/row.result b/mysql-test/r/row.result index 40beeb4d3a5..79eb6cc7e59 100644 --- a/mysql-test/r/row.result +++ b/mysql-test/r/row.result @@ -159,3 +159,9 @@ a MAX(b) (1, MAX(b)) = (1, 4) 1 4 1 10 43 0 drop table t1; +SELECT ROW(2,10) <=> ROW(3,4); +ROW(2,10) <=> ROW(3,4) +0 +SELECT ROW(NULL,10) <=> ROW(3,NULL); +ROW(NULL,10) <=> ROW(3,NULL) +0 diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index 3a17ab803ad..bf79af2831a 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -267,3 +267,5 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 const PRIMARY PRIMARY 4 const 1 2 UNION t1 ref b b 5 const 1 Using where drop table t1,t2; +(select 1) union (select 2) order by 0; +Unknown column '0' in 'order clause' diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test index 1dbdd6e0ae8..8b8d9e4d1a2 100644 --- a/mysql-test/t/derived.test +++ b/mysql-test/t/derived.test @@ -62,3 +62,5 @@ SELECT * FROM (SELECT 1 UNION SELECT a) b; SELECT 1 as a FROM (SELECT a UNION SELECT 1) b; --error 1054 SELECT 1 as a FROM (SELECT 1 UNION SELECT a) b; +--error 1054 +select 1 from (select 2) a order by 0; diff --git a/mysql-test/t/row.test b/mysql-test/t/row.test index 9d69e56f9ee..fb5fff86b11 100644 --- a/mysql-test/t/row.test +++ b/mysql-test/t/row.test @@ -79,3 +79,5 @@ insert into t1 values (10, 43); insert into t1 values (1, 4); select a, MAX(b), (1, MAX(b)) = (1, 4) from t1 group by a; drop table t1; +SELECT ROW(2,10) <=> ROW(3,4); +SELECT ROW(NULL,10) <=> ROW(3,NULL); diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test index 74d04f7e2ce..d41860c1b72 100644 --- a/mysql-test/t/union.test +++ b/mysql-test/t/union.test @@ -142,3 +142,5 @@ explain (select * from t1 where a=1) union (select * from t2 where a=1); explain (select * from t1 where a=1 and b=10) union (select t1.a,t2.a from t1,t2 where t1.a=t2.a); explain (select * from t1 where a=1) union (select * from t1 where b=1); drop table t1,t2; +--error 1054 +(select 1) union (select 2) order by 0; diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index c4197beffbf..301e5b4454f 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -266,8 +266,8 @@ int Arg_comparator::compare_e_row() uint n= (*a)->cols(); for (uint i= 0; i