diff options
Diffstat (limited to 'mysql-test/t/subselect.test')
-rw-r--r-- | mysql-test/t/subselect.test | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index 41cdf9f1c64..8bc47190dca 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -1726,9 +1726,58 @@ select (select a from t1) = (1,2); select (1,2,3) = (select * from t1); -- error 1241 select (select * from t1) = (1,2,3); +drop table t1 + +# +# Item_int_with_ref check (BUG#10020) +# +CREATE TABLE `t1` ( + `itemid` bigint(20) unsigned NOT NULL auto_increment, + `sessionid` bigint(20) unsigned default NULL, + `time` int(10) unsigned NOT NULL default '0', + `type` set('A','D','E','F','G','I','L','N','U') collate latin1_general_ci NOT +NULL default '', + `data` text collate latin1_general_ci NOT NULL, + PRIMARY KEY (`itemid`) +) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; +INSERT INTO `t1` VALUES (1, 1, 1, 'D', ''); +CREATE TABLE `t2` ( + `sessionid` bigint(20) unsigned NOT NULL auto_increment, + `pid` int(10) unsigned NOT NULL default '0', + `date` int(10) unsigned NOT NULL default '0', + `ip` varchar(15) collate latin1_general_ci NOT NULL default '', + PRIMARY KEY (`sessionid`) +) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; +INSERT INTO `t2` VALUES (1, 1, 1, '10.10.10.1'); +SELECT s.ip, count( e.itemid ) FROM `t1` e JOIN t2 s ON s.sessionid = e.sessionid WHERE e.sessionid = ( SELECT sessionid FROM t2 ORDER BY sessionid DESC LIMIT 1 ) GROUP BY s.ip HAVING count( e.itemid ) >0 LIMIT 0 , 30; +drop tables t1,t2; + +# BUG#11821 : Select from subselect using aggregate function on an enum +# segfaults: +create table t1 (fld enum('0','1')); +insert into t1 values ('1'); +select * from (select max(fld) from t1) as foo; drop table t1; # +# Bug #11867: queries with ROW(,elems>) IN (SELECT DISTINCT <cols> FROM ...) +# + +CREATE TABLE t1 (one int, two int, flag char(1)); +CREATE TABLE t2 (one int, two int, flag char(1)); +INSERT INTO t1 VALUES(1,2,'Y'),(2,3,'Y'),(3,4,'Y'),(5,6,'N'),(7,8,'N'); +INSERT INTO t2 VALUES(1,2,'Y'),(2,3,'Y'),(3,4,'Y'),(5,6,'N'),(7,8,'N'); + +SELECT * FROM t1 + WHERE ROW(one,two) IN (SELECT DISTINCT one,two FROM t2 WHERE flag = 'N'); +SELECT * FROM t1 + WHERE ROW(one,two) IN (SELECT DISTINCT one,two FROM t1 WHERE flag = 'N'); + +DROP TABLE t1,t2; + +# End of 4.1 tests + +# #decimal-related tests # create table t1 (df decimal(5,1)); @@ -1868,4 +1917,3 @@ select * from (select max(fld) from t1) as foo; drop table t1; -# End of 4.1 tests |