From 53e4153de12d9288d55294826dbf30e4ce508224 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 30 Jul 2003 14:15:25 +0500 Subject: Derivation attribute was not processed correctly by MAX/MIN in some cases: SELECT coercibility(max(s1)) from t1; Subselect collation and derivation was not processed correctly: create table a select (select s1 from t1); select * from t1 where s1 = (select s2 from t1); --- mysql-test/r/func_group.result | 6 ++++++ mysql-test/r/subselect.result | 13 +++++++++++++ mysql-test/t/func_group.test | 5 +++++ mysql-test/t/subselect.test | 13 ++++++++++++- 4 files changed, 36 insertions(+), 1 deletion(-) (limited to 'mysql-test') diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result index 26ef391024e..8fad9d16dc2 100644 --- a/mysql-test/r/func_group.result +++ b/mysql-test/r/func_group.result @@ -612,3 +612,9 @@ select Case When Count(*) < MAX_REQ Then 1 Else 0 End from t1 where t1.USR_ID = Case When Count(*) < MAX_REQ Then 1 Else 0 End 1 drop table t1; +create table t1 (a char(10)); +insert into t1 values ('a'),('b'),('c'); +select coercibility(max(a)) from t1; +coercibility(max(a)) +3 +drop table t1; diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index bba86ff8891..7f2cb29dd4c 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -1225,3 +1225,16 @@ a (select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 an 2 2 1 2 drop table t1,t2,t3; +create table t1 (a char(10) character set koi8r collate koi8r_bin); +create table t2 select (select a from t1); +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `(select a from t1)` char(10) character set koi8r collate koi8r_bin default NULL +) TYPE=MyISAM CHARSET=latin1 +drop table t1,t2; +CREATE TABLE t1 +(s1 CHAR(5) COLLATE latin1_german1_ci, +s2 CHAR(5) COLLATE latin1_swedish_ci); +SELECT * FROM t1 WHERE s1 = (SELECT s2 FROM t1); +ERROR HY000: Illegal mix of collations (latin1_german1_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT) for operation '=' diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test index fed19cbe07c..8a43716d854 100644 --- a/mysql-test/t/func_group.test +++ b/mysql-test/t/func_group.test @@ -355,3 +355,8 @@ insert into t1 values (1, 3); select count(*) + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ from t1 group by MAX_REQ; select Case When Count(*) < MAX_REQ Then 1 Else 0 End from t1 where t1.USR_ID = 1 group by MAX_REQ; drop table t1; + +create table t1 (a char(10)); +insert into t1 values ('a'),('b'),('c'); +select coercibility(max(a)) from t1; +drop table t1; diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index 66d8dd2bc32..e7c63098cab 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -817,4 +817,15 @@ insert into t1 values (0,100),(1,2), (1,3), (2,2), (2,7), (2,-1), (3,10); insert into t2 values (0,0), (1,1), (2,1), (3,1), (4,1); insert into t3 values (3,3), (2,2), (1,1); select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) from t3; -drop table t1,t2,t3;s +drop table t1,t2,t3; + +create table t1 (a char(10) character set koi8r collate koi8r_bin); +create table t2 select (select a from t1); +show create table t2; +drop table t1,t2; + +CREATE TABLE t1 +(s1 CHAR(5) COLLATE latin1_german1_ci, + s2 CHAR(5) COLLATE latin1_swedish_ci); +--error 1265 +SELECT * FROM t1 WHERE s1 = (SELECT s2 FROM t1); -- cgit v1.2.1