475
475
drop table t1,t2,t3;
477
477
#LIMIT is not supported now
478
create table t1 (a float);
479
select 10.5 IN (SELECT * from t1 LIMIT 1);
480
select 10.5 IN (SELECT * from t1 LIMIT 1 UNION SELECT 1.5);
483
create table t1 (a int, b int, c varchar(10));
484
create table t2 (a int);
485
insert into t1 values (1,2,'a'),(2,3,'b'),(3,4,'c');
486
insert into t2 values (1),(2),(NULL);
487
select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a'),(select c from t1 where a=t2.a) from t2;
488
select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b'),(select c from t1 where a=t2.a) from t2;
489
select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c'),(select c from t1 where a=t2.a) from t2;
492
create table t1 (a int, b real, c varchar(10));
493
insert into t1 values (1, 1, 'a'), (2,2,'b'), (NULL, 2, 'b');
494
select ROW(1, 1, 'a') IN (select a,b,c from t1);
495
select ROW(1, 2, 'a') IN (select a,b,c from t1);
496
select ROW(1, 1, 'a') IN (select b,a,c from t1);
497
select ROW(1, 1, 'a') IN (select a,b,c from t1 where a is not null);
498
select ROW(1, 2, 'a') IN (select a,b,c from t1 where a is not null);
499
select ROW(1, 1, 'a') IN (select b,a,c from t1 where a is not null);
500
select ROW(1, 1, 'a') IN (select a,b,c from t1 where c='b' or c='a');
501
select ROW(1, 2, 'a') IN (select a,b,c from t1 where c='b' or c='a');
502
select ROW(1, 1, 'a') IN (select b,a,c from t1 where c='b' or c='a');
503
select ROW(1, 1, 'a') IN (select b,a,c from t1 limit 2);
478
#create table t1 (a float);
480
#select 10.5 IN (SELECT * from t1 LIMIT 1);
482
#select 10.5 IN (SELECT * from t1 LIMIT 1 UNION SELECT 1.5);
485
#create table t1 (a int, b int, c varchar(10));
486
#create table t2 (a int);
487
#insert into t1 values (1,2,'a'),(2,3,'b'),(3,4,'c');
488
#insert into t2 values (1),(2),(NULL);
489
#select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a'),(select c from t1 where a=t2.a) from t2;
490
#select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b'),(select c from t1 where a=t2.a) from t2;
491
#select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c'),(select c from t1 where a=t2.a) from t2;
494
#create table t1 (a int, b real, c varchar(10));
495
#insert into t1 values (1, 1, 'a'), (2,2,'b'), (NULL, 2, 'b');
496
#select ROW(1, 1, 'a') IN (select a,b,c from t1);
497
#select ROW(1, 2, 'a') IN (select a,b,c from t1);
498
#select ROW(1, 1, 'a') IN (select b,a,c from t1);
499
#select ROW(1, 1, 'a') IN (select a,b,c from t1 where a is not null);
500
#select ROW(1, 2, 'a') IN (select a,b,c from t1 where a is not null);
501
#select ROW(1, 1, 'a') IN (select b,a,c from t1 where a is not null);
502
#select ROW(1, 1, 'a') IN (select a,b,c from t1 where c='b' or c='a');
503
#select ROW(1, 2, 'a') IN (select a,b,c from t1 where c='b' or c='a');
504
#select ROW(1, 1, 'a') IN (select b,a,c from t1 where c='b' or c='a');
506
#select ROW(1, 1, 'a') IN (select b,a,c from t1 limit 2);
506
509
#test of uncacheable subqueries
507
510
CREATE TABLE t1 (a int);
516
516
CREATE TABLE `t1` (
517
`mot` varchar(30) character set latin1 NOT NULL default '',
517
`mot` varchar(30) NOT NULL default '',
518
518
`topic` bigint unsigned NOT NULL default '0',
519
519
`date` date NOT NULL default '0000-00-00',
520
`pseudo` varchar(35) character set latin1 NOT NULL default '',
520
`pseudo` varchar(35) NOT NULL default '',
521
521
PRIMARY KEY (`mot`,`pseudo`,`date`,`topic`),
522
522
KEY `pseudo` (`pseudo`,`date`,`topic`),
523
523
KEY `topic` (`topic`)
524
524
) ENGINE=MyISAM ROW_FORMAT=DYNAMIC;
526
526
CREATE TABLE `t2` (
527
`mot` varchar(30) character set latin1 NOT NULL default '',
527
`mot` varchar(30) NOT NULL default '',
528
528
`topic` bigint unsigned NOT NULL default '0',
529
529
`date` date NOT NULL default '0000-00-00',
530
`pseudo` varchar(35) character set latin1 NOT NULL default '',
530
`pseudo` varchar(35) NOT NULL default '',
531
531
PRIMARY KEY (`mot`,`pseudo`,`date`,`topic`),
532
532
KEY `pseudo` (`pseudo`,`date`,`topic`),
533
533
KEY `topic` (`topic`)
1587
1587
# Item_int_with_ref check (BUG#10020)
1590
`itemid` bigint unsigned NOT NULL auto_increment,
1591
`sessionid` bigint unsigned default NULL,
1592
`time` int unsigned NOT NULL default '0',
1593
`data` text collate latin1_general_ci NOT NULL,
1594
PRIMARY KEY (`itemid`)
1596
INSERT INTO `t1` VALUES (1, 1, 1, '');
1598
`sessionid` bigint unsigned NOT NULL auto_increment,
1599
`pid` int unsigned NOT NULL default '0',
1600
`date` int unsigned NOT NULL default '0',
1601
`ip` varchar(15) collate latin1_general_ci NOT NULL default '',
1602
PRIMARY KEY (`sessionid`)
1604
INSERT INTO `t2` VALUES (1, 1, 1, '10.10.10.1');
1605
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;
1589
#CREATE TABLE `t1` (
1590
# `itemid` bigint unsigned NOT NULL auto_increment,
1591
# `sessionid` bigint unsigned default NULL,
1592
# `time` int unsigned NOT NULL default '0',
1593
# `data` text collate latin1_general_ci NOT NULL,
1594
# PRIMARY KEY (`itemid`)
1596
#INSERT INTO `t1` VALUES (1, 1, 1, '');
1597
#CREATE TABLE `t2` (
1598
# `sessionid` bigint unsigned NOT NULL auto_increment,
1599
# `pid` int unsigned NOT NULL default '0',
1600
# `date` int unsigned NOT NULL default '0',
1601
# `ip` varchar(15) collate latin1_general_ci NOT NULL default '',
1602
# PRIMARY KEY (`sessionid`)
1604
#INSERT INTO `t2` VALUES (1, 1, 1, '10.10.10.1');
1605
#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;
1608
1608
# BUG#11821 : Select from subselect using aggregate function on an enum