~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/select.test

  • Committer: Mark Atwood
  • Date: 2009-01-05 04:37:22 UTC
  • mto: (758.1.1 devel)
  • mto: This revision was merged to the branch mainline in revision 759.
  • Revision ID: me@mark.atwood.name-20090105043722-03l4mzcxi4yjjjih
replace sql_print_error etc with errmsg_print

Show diffs side-by-side

added added

removed removed

Lines of Context:
1332
1332
# If the like starts with a certain letter key will be used.
1333
1333
#
1334
1334
 
 
1335
--sorted_result
1335
1336
select fld1,fld3 from t2 where companynr = 37 and fld3 like 'f%';
1336
1337
select fld3 from t2 where fld3 like "L%" and fld3 = "ok";
1337
1338
select fld3 from t2 where (fld3 like "C%" and fld3 = "Chantilly");
1348
1349
select distinct companynr from t2;
1349
1350
select distinct companynr from t2 order by companynr;
1350
1351
select distinct companynr from t2 order by companynr desc;
 
1352
--sorted_result
1351
1353
select distinct t2.fld3,period from t2,t1 where companynr=37 and fld3 like "O%";
1352
1354
 
1353
1355
select distinct fld3 from t2 where companynr = 34 order by fld3;
 
1356
# PBXT: because there is no ORDER BY with a LIMIT, these
 
1357
# statements return different results to those from innodb
 
1358
--sorted_result
1354
1359
select distinct fld3 from t2 limit 10;
1355
1360
select distinct fld3 from t2 having fld3 like "A%" limit 10;
1356
1361
select distinct substring(fld3,1,3) from t2 where fld3 like "A%";
1357
1362
select distinct substring(fld3,1,3) as a from t2 having a like "A%" order by a limit 10;
1358
1363
select distinct substring(fld3,1,3) from t2 where fld3 like "A%" limit 10;
 
1364
--sorted_result
1359
1365
select distinct substring(fld3,1,3) as a from t2 having a like "A%" limit 10;
1360
1366
 
1361
1367
# make a big table.
1411
1417
 
1412
1418
# big table done
1413
1419
 
1414
 
SET SQL_BIG_TABLES=1;
1415
1420
select distinct concat(fld3," ",fld3) as namn from t2,t3 where t2.fld1=t3.t2nr order by namn limit 10;
1416
 
SET SQL_BIG_TABLES=0;
1417
1421
select distinct concat(fld3," ",fld3) from t2,t3 where t2.fld1=t3.t2nr order by fld3 limit 10;
1418
1422
select distinct fld5 from t2 limit 10;
1419
1423
 
1422
1426
#
1423
1427
 
1424
1428
select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
1425
 
SET SQL_BIG_TABLES=1; # Force use of MyISAM
1426
1429
select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
1427
 
SET SQL_BIG_TABLES=0;
1428
1430
select distinct fld3,repeat("a",length(fld3)),count(*) from t2 group by companynr,fld3 limit 100,10;
1429
1431
 
1430
1432
#
1474
1476
# Search with a constant table and several rows from another table
1475
1477
#
1476
1478
 
 
1479
--sorted_result
1477
1480
select fld3,period from t2,t1 where companynr*10 = 37*10;
1478
1481
 
1479
1482
#
1831
1834
select * from (t1 as t2 left join t1 as t3 using (a)) straight_join t1;
1832
1835
select * from t1 straight_join (t1 as t2 left join t1 as t3 using (a));
1833
1836
# inner join on
 
1837
--sorted_result
1834
1838
select * from (t1 as t2 left join t1 as t3 using (a)) inner join t1 on t1.a>1;
1835
1839
select * from t1 inner join (t1 as t2 left join t1 as t3 using (a)) on t1.a>1;
1836
1840
# inner join using
2169
2173
create table t1 (f1 int not null auto_increment primary key, f2 varchar(10));
2170
2174
create table t11 like t1;
2171
2175
insert into t1 values(1,""),(2,"");
2172
 
--replace_column 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X
 
2176
--replace_column 3 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X
2173
2177
show table status like 't1%';
2174
2178
select 123 as a from t1 where f1 is null;
2175
2179
drop table t1,t11;
2975
2979
SELECT COUNT(*) FROM t1 WHERE ID1_with_null IS NULL AND ID2_with_null IS NULL;
2976
2980
SELECT COUNT(*) FROM t1 WHERE ID_better=1;
2977
2981
 
 
2982
# PBXT: does not return a consistent row count
 
2983
--replace_column 9 #
2978
2984
EXPLAIN SELECT * FROM t1
2979
2985
  WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null=3 ;
 
2986
--replace_column 9 #
2980
2987
EXPLAIN SELECT * FROM t1
2981
2988
  WHERE ID_better=1 AND ID1_with_null=3 AND ID2_with_null=3 IS NULL ;
 
2989
--replace_column 9 #
2982
2990
EXPLAIN SELECT * FROM t1
2983
2991
  WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null IS NULL;
2984
2992