~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to tests/t/select.test

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-10-02 14:17:48 UTC
  • mfrom: (1.1.1 upstream)
  • mto: (2.1.17 sid)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20101002141748-m6vbfbfjhrw1153e
Tags: 2010.09.1802-1
* New upstream release.
* Removed pid-file argument hack.
* Updated GPL-2 address to be new address.
* Directly copy in drizzledump.1 since debian doesn't have sphinx 1.0 yet.
* Link to jquery from libjs-jquery. Add it as a depend.
* Add drizzled.8 symlink to the install files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1535
1535
#
1536
1536
 
1537
1537
select * from t1,t1 t12;
 
1538
--sorted_result
1538
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;
1539
1540
 
1540
1541
#
1794
1795
INSERT INTO t1 VALUES (200001,2,1,1,100,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\E$',''),(200002,2,2,1,101,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\C$',''),(200003,1,3,2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,0,1,20020425060427,'c:',NULL);
1795
1796
CREATE TEMPORARY TABLE t2 (  hmid int default NULL,  volid int default NULL,  sampletid int default NULL,  sampletime datetime default NULL,  samplevalue bigint default NULL,  KEY idx1 (hmid,volid,sampletid,sampletime)) ENGINE=MyISAM;
1796
1797
INSERT INTO t2 VALUES (1,3,10,'2002-06-01 08:00:00',35),(1,3,1010,'2002-06-01 12:00:01',35);
1797
 
--error 1686 # bad datetime
 
1798
--error ER_INVALID_DATETIME_VALUE # bad datetime
1798
1799
SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= 'wrong-date-value' AND b.sampletime < 'wrong-date-value' AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid;
1799
1800
# Testing the same select with NULL's instead of invalid datetime values
1800
1801
SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= NULL AND b.sampletime < NULL AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid;
1828
1829
insert into t1 values ();
1829
1830
insert into t1 values ();
1830
1831
# ,
 
1832
--sorted_result
1831
1833
select * from (t1 as t2 left join t1 as t3 using (a)), t1;
1832
1834
select * from t1, (t1 as t2 left join t1 as t3 using (a));
1833
1835
# stright_join
1989
1991
create table t1 (a int);
1990
1992
select all all * from t1;
1991
1993
select distinct distinct * from t1;
1992
 
--error 1221
 
1994
--error ER_WRONG_USAGE
1993
1995
select all distinct * from t1;
1994
 
--error 1221
 
1996
--error ER_WRONG_USAGE
1995
1997
select distinct all * from t1;
1996
1998
drop table t1;
1997
1999
 
2237
2239
INSERT INTO t1 VALUES (2), (3), (1);
2238
2240
 
2239
2241
EXPLAIN SELECT * FROM t1 IGNORE INDEX (idx);
2240
 
--error 1176
 
2242
--error ER_KEY_DOES_NOT_EXITS
2241
2243
EXPLAIN SELECT * FROM t1 IGNORE INDEX (a);
2242
 
--error 1176
 
2244
--error ER_KEY_DOES_NOT_EXITS
2243
2245
EXPLAIN SELECT * FROM t1 FORCE INDEX (a);
2244
2246
 
2245
2247
DROP TABLE t1;
2587
2589
insert into t1 values(1,'2005-01-01'),(2,'2005-09-01'),(3,'2005-09-30'),
2588
2590
  (4,'2005-10-01'),(5,'2005-12-30');
2589
2591
# should return all records
2590
 
--error 1686 # Bad date
 
2592
--error ER_INVALID_DATETIME_VALUE # Bad date
2591
2593
select * from t1 where f2 >= 0            order by f2;
2592
 
--error 1686 # Bad date
 
2594
--error ER_INVALID_DATETIME_VALUE # Bad date
2593
2595
select * from t1 where f2 >= '0000-00-00' order by f2;
2594
2596
# should return 4,5
2595
 
--error 1686 # Bad date
 
2597
--error ER_INVALID_DATETIME_VALUE # Bad date
2596
2598
select * from t1 where f2 >= '2005-09-31' order by f2;
2597
 
--error 1686 # Bad date
 
2599
--error ER_INVALID_DATETIME_VALUE # Bad date
2598
2600
select * from t1 where f2 >= '2005-09-3a' order by f2;
2599
 
--error 1686 # Bad date
 
2601
--error ER_INVALID_DATETIME_VALUE # Bad date
2600
2602
select * from t1 where f2 <= '2005-09-31' order by f2;
2601
 
--error 1686 # Bad date
 
2603
--error ER_INVALID_DATETIME_VALUE # Bad date
2602
2604
select * from t1 where f2 <= '2005-09-3a' order by f2;
2603
2605
drop table t1;
2604
2606
 
2687
2689
#
2688
2690
# Bug#15538 unchecked table absense caused server crash.
2689
2691
#
2690
 
--error 1064
 
2692
--error ER_PARSE_ERROR
2691
2693
select * from (select * left join t on f1=f2) tt;
2692
2694
 
2693
2695
#
3471
3473
SELECT * FROM t2 LEFT JOIN t1 ON a = b + 1;
3472
3474
EXPLAIN EXTENDED SELECT * FROM t2 LEFT JOIN t1 ON a = b + 1;
3473
3475
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a > UNIX_TIMESTAMP('2009-03-10 00:00:00');
 
3476
 
 
3477
DROP TABLE t1, t2;