~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/include/common-tests.inc

  • Committer: Jay Pipes
  • Date: 2009-02-21 16:00:06 UTC
  • mto: (907.1.1 trunk-with-temporal)
  • mto: This revision was merged to the branch mainline in revision 908.
  • Revision ID: jpipes@serialcoder-20090221160006-vnk3wt4qbcz62eru
Removes the TIME column type and related time functions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
CREATE TABLE t1 (
17
17
  Period int DEFAULT '0000' NOT NULL,
18
18
  Varor_period int DEFAULT '0' NOT NULL
19
 
);
 
19
) ENGINE=myisam;
20
20
 
21
21
INSERT INTO t1 VALUES (9410,9412);
22
22
  
39
39
  UNIQUE fld1 (fld1),
40
40
  KEY fld3 (fld3),
41
41
  PRIMARY KEY (auto)
42
 
);
 
42
) ENGINE=myisam;  
43
43
 
44
44
#
45
45
# Populate table
46
46
#
47
47
 
48
48
--disable_query_log
49
 
begin;
50
49
INSERT INTO t2 VALUES (1,000001,00,'Omaha','teethe','neat','');
51
50
INSERT INTO t2 VALUES (2,011401,37,'breaking','dreaded','Steinberg','W');
52
51
INSERT INTO t2 VALUES (3,011402,37,'Romans','scholastics','jarring','');
1246
1245
INSERT INTO t2 VALUES (1191,068504,00,'bonfire','corresponds','positively','');
1247
1246
INSERT INTO t2 VALUES (1192,068305,00,'Colombo','hardware','colicky','');
1248
1247
INSERT INTO t2 VALUES (1193,000000,00,'nondecreasing','implant','thrillingly','');
1249
 
commit;
1250
1248
--enable_query_log
1251
1249
 
1252
1250
#
1285
1283
# Test using INDEX and IGNORE INDEX
1286
1284
#
1287
1285
 
1288
 
--replace_column 9 #
1289
1286
explain select t2.fld3 from t2 where fld3 = 'honeysuckle';
1290
1287
 
1291
 
--replace_column 9 #
1292
1288
explain select fld3 from t2 ignore index (fld3) where fld3 = 'honeysuckle';
1293
 
--replace_column 9 #
1294
1289
explain select fld3 from t2 use index (fld1) where fld3 = 'honeysuckle';
1295
1290
 
1296
 
--replace_column 9 #
1297
1291
explain select fld3 from t2 use index (fld3) where fld3 = 'honeysuckle';
1298
 
--replace_column 9 #
1299
1292
explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle';
1300
1293
 
1301
1294
#
1313
1306
#
1314
1307
 
1315
1308
select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3;
1316
 
--replace_column 9 #
1317
1309
explain select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3;
1318
1310
select fld1,fld3 from t2 where fld3="Colombo" or fld3 = "nondecreasing" order by fld3;
1319
1311
 
1332
1324
#
1333
1325
 
1334
1326
select fld1 from t2 where fld1=250501 or fld1="250502";
1335
 
--replace_column 9 #
1336
1327
explain select fld1 from t2 where fld1=250501 or fld1="250502"; 
1337
1328
select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502;
1338
 
--replace_column 9 #
1339
1329
explain select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502;
1340
1330
 
1341
1331
#
1359
1349
select distinct companynr from t2;
1360
1350
select distinct companynr from t2 order by companynr;
1361
1351
select distinct companynr from t2 order by companynr desc;
1362
 
select distinct t2.fld3,period from t2,t1 where companynr=37 and fld3 like "O%" ORDER BY t2.fld3,period;
 
1352
select distinct t2.fld3,period from t2,t1 where companynr=37 and fld3 like "O%";
1363
1353
 
1364
1354
select distinct fld3 from t2 where companynr = 34 order by fld3;
1365
 
select distinct fld3 from t2 ORDER BY fld3 limit 10;
 
1355
select distinct fld3 from t2 limit 10;
1366
1356
select distinct fld3 from t2 having fld3 like "A%" limit 10;
1367
1357
select distinct substring(fld3,1,3) from t2 where fld3 like "A%";
1368
 
select distinct lower(substring(fld3,1,3)) as a from t2 having a like "A%" order by a limit 10;
 
1358
select distinct substring(fld3,1,3) as a from t2 having a like "A%" order by a limit 10;
1369
1359
select distinct substring(fld3,1,3) from t2 where fld3 like "A%" limit 10;
 
1360
select distinct substring(fld3,1,3) as a from t2 having a like "A%" limit 10;
1370
1361
 
1371
1362
# make a big table.
1372
1363
 
1378
1369
 price2     double(11,0),
1379
1370
 key (period),
1380
1371
 key (name)
1381
 
);
 
1372
) engine=myisam;
1382
1373
 
1383
1374
--disable_query_log
1384
 
BEGIN;
1385
1375
INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1001,"Iranizes",37,5987435,234724);
1386
1376
INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1002,"violinist",37,28357832,8723648);
1387
1377
INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1003,"extramarital",37,39654943,235872);
1392
1382
INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1008,"tucked",311,234298,3275892);
1393
1383
INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1009,"gems",447,2374834,9872392);
1394
1384
INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1010,"clinker",512,786542,76234234);
1395
 
COMMIT;
1396
1385
--enable_query_log
1397
1386
 
1398
1387
create temporary table tmp engine = myisam select * from t3;
1451
1440
# Here the last fld3 is optimized away from the order by
1452
1441
#
1453
1442
 
1454
 
--replace_column 9 #
1455
1443
explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by t3.t2nr,fld3;
1456
1444
 
1457
1445
#
1458
1446
# Some test with ORDER BY and limit
1459
1447
#
1460
1448
 
1461
 
--replace_column 9 #
1462
1449
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period;
1463
 
--replace_column 9 #
1464
1450
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
1465
 
--replace_column 9 #
1466
1451
explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;
1467
1452
 
1468
1453
#
1480
1465
 
1481
1466
select fld3,period from t2,t3 where t2.fld1 = 011401 and t2.fld1=t3.t2nr and t3.period=1001;
1482
1467
 
1483
 
--replace_column 9 #
1484
1468
explain select fld3,period from t2,t3 where t2.fld1 = 011401 and t3.t2nr=t2.fld1 and 1001 = t3.period;
1485
1469
 
1486
1470
#
1487
1471
# Search with a constant table and several rows from another table
1488
1472
#
1489
1473
 
1490
 
--sorted_result
1491
1474
select fld3,period from t2,t1 where companynr*10 = 37*10;
1492
1475
 
1493
1476
#
1509
1492
# We need another table for join stuff..
1510
1493
#
1511
1494
 
1512
 
create temporary table t4 (
 
1495
create table t4 (
1513
1496
  companynr int NOT NULL default '00',
1514
1497
  companyname char(30) NOT NULL default '',
1515
1498
  PRIMARY KEY (companynr),
1516
1499
  UNIQUE KEY companyname(companyname)
1517
 
) ENGINE=MyISAM COMMENT='companynames';
 
1500
) ENGINE=MyISAM MAX_ROWS=50 PACK_KEYS=1 COMMENT='companynames';
1518
1501
 
1519
1502
--disable_query_log
1520
1503
INSERT INTO t4 (companynr, companyname) VALUES (29,'company 1');
1553
1536
 
1554
1537
select t2.companynr,companyname from t2 left join t4 using (companynr) where t4.companynr is null;
1555
1538
select count(*) from t2 left join t4 using (companynr) where t4.companynr is not null;
1556
 
--replace_column 9 #
1557
1539
explain select t2.companynr,companyname from t2 left join t4 using (companynr) where t4.companynr is null;
1558
 
--replace_column 9 #
1559
1540
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr is null;
1560
1541
 
1561
1542
select companynr,companyname from t2 left join t4 using (companynr) where companynr is null;
1562
1543
select count(*) from t2 left join t4 using (companynr) where companynr is not null;
1563
 
--replace_column 9 #
1564
1544
explain select companynr,companyname from t2 left join t4 using (companynr) where companynr is null;
1565
 
--replace_column 9 #
1566
1545
explain select companynr,companyname from t4 left join t2 using (companynr) where companynr is null;
1567
1546
delete from t2 where fld1=999999;
1568
1547
 
1569
1548
#
1570
1549
# Test left join optimization
1571
1550
 
1572
 
--replace_column 9 #
1573
1551
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0;
1574
 
--replace_column 9 #
1575
1552
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0;
1576
 
--replace_column 9 #
1577
1553
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 and t4.companynr > 0;
1578
1554
 
1579
 
--replace_column 9 #
1580
1555
explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0;
1581
 
--replace_column 9 #
1582
1556
explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0;
1583
 
--replace_column 9 #
1584
1557
explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 and companynr > 0;
1585
1558
# Following can't be optimized
1586
 
--replace_column 9 #
1587
1559
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr is null;
1588
 
--replace_column 9 #
1589
1560
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0 or t4.companynr > 0;
1590
 
--replace_column 9 #
1591
1561
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where ifnull(t2.companynr,1)>0;
1592
1562
 
1593
 
--replace_column 9 #
1594
1563
explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr is null;
1595
 
--replace_column 9 #
1596
1564
explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0 or companynr > 0;
1597
 
--replace_column 9 #
1598
1565
explain select companynr,companyname from t4 left join t2 using (companynr) where ifnull(companynr,1)>0;
1599
1566
 
1600
1567
#
1602
1569
#
1603
1570
 
1604
1571
select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1;
1605
 
--replace_column 9 #
1606
1572
explain select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1;
1607
1573
 
1608
1574
#
1642
1608
select companynr,count(*),sum(fld1) from t2 group by companynr;
1643
1609
select companynr,count(*) from t2 group by companynr order by companynr desc limit 5;
1644
1610
select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 where companynr = 34 and fld4<>"";
1645
 
--replace_column 9 #
1646
1611
explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 where companynr = 34 and fld4<>"";
1647
1612
select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3;
1648
1613
select companynr,t2nr,count(price),sum(price),min(price),max(price),avg(price) from t3 where companynr = 37 group by companynr,t2nr limit 10;
1732
1697
 
1733
1698
select t2.fld1,sum(price) from t3,t2 where t2.fld1 = t3.t2nr and t3.companynr = 512 and t3.t2nr = 38008 and t2.fld1 = 38008 or t2.fld1 = t3.t2nr and t3.t2nr = 38008 and t2.fld1 = 38008 or t3.t2nr = t2.fld1 and t2.fld1 = 38008 group by t2.fld1;
1734
1699
 
1735
 
--replace_column 9 #
1736
1700
explain select fld3 from t2 where 1>2 or 2>3;
1737
 
--replace_column 9 #
1738
1701
explain select fld3 from t2 where fld1=fld1;
1739
1702
 
1740
1703
#
1760
1723
select max(fld1) from t2 where fld1>= 098024;
1761
1724
select count(*) from t3 where price2=76234234;
1762
1725
select count(*) from t3 where companynr=512 and price2=76234234;
1763
 
--replace_column 9 #
1764
1726
explain select min(fld1),max(fld1),count(*) from t2;
1765
1727
# PS does correct pre-zero here. MySQL can't do it as it returns a number.
1766
1728
--disable_ps_protocol
1797
1759
show full columns from t2 from test like 'f%';
1798
1760
--replace_column 8 #
1799
1761
show full columns from t2 from test like 's%';
1800
 
--replace_column 7 #
1801
1762
show keys from t2;
1802
1763
 
1803
1764
drop table t4, t3, t2, t1;
1804
1765
 
1805
1766
 
1806
 
CREATE TEMPORARY TABLE t1 (
 
1767
CREATE TABLE t1 (
1807
1768
  cont_nr int NOT NULL auto_increment,
1808
1769
  ver_nr int NOT NULL default '0',
1809
1770
  aufnr int NOT NULL default '0',