~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/select.test

  • Committer: Monty Taylor
  • Date: 2011-02-13 17:26:39 UTC
  • mfrom: (2157.2.2 give-in-to-pkg-config)
  • mto: This revision was merged to the branch mainline in revision 2166.
  • Revision ID: mordred@inaugust.com-20110213172639-nhy7i72sfhoq13ms
Merged in pkg-config fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1297
1297
# The next should give an error
1298
1298
#
1299
1299
 
1300
 
#-- error 1176
 
1300
#-- error ER_KEY_DOES_NOT_EXITS
1301
1301
#explain select fld3 from t2 ignore index (fld3,not_used);
1302
 
#-- error 1176
 
1302
#-- error ER_KEY_DOES_NOT_EXITS
1303
1303
#explain select fld3 from t2 use index (not_used);
1304
1304
 
1305
1305
#
1534
1534
# Full join (same alias)
1535
1535
#
1536
1536
 
1537
 
select * from t1,t1 t12;
 
1537
select * from t1 CROSS JOIN t1 t12;
1538
1538
--sorted_result
1539
1539
select t2.fld1,t22.fld1 from t2,t2 t22 where t2.fld1 >= 250501 and t2.fld1 <= 250505 and t22.fld1 >= 250501 and t22.fld1 <= 250505;
1540
1540
 
2487
2487
INSERT INTO t1 VALUES (1),(2),(3);
2488
2488
INSERT INTO t2 VALUES (2);
2489
2489
INSERT INTO t3 VALUES (3);
 
2490
--error ER_NON_UNIQ_ERROR
2490
2491
SELECT t1.id,t3.id FROM t1 JOIN t2 ON (t2.id=t1.id) LEFT JOIN t3 USING (id);
 
2492
--error ER_NON_UNIQ_ERROR
2491
2493
SELECT t1.id,t3.id FROM t1 JOIN t2 ON (t2.notacolumn=t1.id) LEFT JOIN t3 USING (id);
 
2494
--error ER_NON_UNIQ_ERROR
2492
2495
SELECT id,t3.id FROM t1 JOIN t2 ON (t2.id=t1.id) LEFT JOIN t3 USING (id);
 
2496
--error ER_NON_UNIQ_ERROR
2493
2497
SELECT id,t3.id FROM (t1 JOIN t2 ON (t2.id=t1.id)) LEFT JOIN t3 USING (id);
2494
2498
 
2495
2499
drop table t1, t2, t3;
2528
2528
select * from t1 join t2 join t3 on (t2.b = t3.b and t1.a = t3.a);
2529
2529
# Notice that ',' has lower priority than 'join', thus we have that:
2530
2530
# t1, t2 join t3 <==> t1, (t2 join t3).
 
2531
--error ER_BAD_FIELD_ERROR
2531
2532
select * from t1, t2 join t3 on (t2.b = t3.b and t1.a = t3.a);
2532
2533
select * from t1 join t2 join t3 join t4 on (t1.a = t4.c and t2.b = t4.c);
2533
2534
select * from t1 join t2 join t4 using (c);
2589
2589
insert into t1 values(1,'2005-01-01'),(2,'2005-09-01'),(3,'2005-09-30'),
2590
2590
  (4,'2005-10-01'),(5,'2005-12-30');
2591
2591
# should return all records
2592
 
--error ER_INVALID_DATETIME_VALUE # Bad date
 
2592
--error ER_INVALID_DATE_VALUE # Bad date
2593
2593
select * from t1 where f2 >= 0            order by f2;
2594
2594
--error ER_INVALID_DATETIME_VALUE # Bad date
2595
2595
select * from t1 where f2 >= '0000-00-00' order by f2;
2720
2720
create table t1 (a int);
2721
2721
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
2722
2722
create table t2 (a int, b int, c int, e int, primary key(a,b,c));
2723
 
insert into t2 select A.a, B.a, C.a, C.a from t1 A, t1 B, t1 C;
 
2723
insert into t2 select A.a, B.a, C.a, C.a from t1 A CROSS JOIN t1 B CROSS JOIN t1 C;
2724
2724
analyze table t2;
2725
2725
select 'In next EXPLAIN, B.rows must be exactly 10:' Z;
2726
2726
 
3278
3278
                 KEY (c33, c34, c32));
3279
3279
 
3280
3280
INSERT INTO t1 values (),(),(),(),();
3281
 
INSERT INTO t2 SELECT a.c11, b.c11 FROM t1 a, t1 b;
 
3281
INSERT INTO t2 SELECT a.c11, b.c11 FROM t1 a CROSS JOIN t1 b;
3282
3282
INSERT INTO t3 VALUES (1, 1, 1, 0), 
3283
3283
                      (2, 2, 0, 0), 
3284
3284
                      (3, 3, 1, 0),