~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/group_by.test

  • Committer: Jay Pipes
  • Date: 2009-09-15 21:01:42 UTC
  • mto: (1126.2.5 merge)
  • mto: This revision was merged to the branch mainline in revision 1128.
  • Revision ID: jpipes@serialcoder-20090915210142-x8mwiqn1q0vzjspp
Moves Alter_info out into its own header and source file, cleans up some related include mess in sql_lex.h, and renames Alter_info to AlterInfo.

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
#
8
8
# Simple test without tables
9
9
 
10
 
--error ER_INVALID_GROUP_FUNC_USE
 
10
-- error 1111
11
11
SELECT 1 FROM (SELECT 1) as a  GROUP BY SUM(1);
12
12
 
13
13
#
70
70
  operator int,
71
71
  method enum('unknown','cash','dealer','check','card','lazy','delayed','test') DEFAULT 'unknown' NOT NULL,
72
72
  DIID int,
73
 
  reason char(1) DEFAULT '' NOT NULL,
 
73
  reason char(1) binary DEFAULT '' NOT NULL,
74
74
  code_id int,
75
75
  qty int DEFAULT '0' NOT NULL,
76
76
  PRIMARY KEY (PID),
82
82
 
83
83
INSERT INTO t1 VALUES (1,'1970-01-01','1997-10-17 00:00:00',2529,1,21000,11886,'check',0,'F',16200,6);
84
84
 
85
 
--error ER_WRONG_GROUP_FIELD
 
85
--error 1056
86
86
SELECT COUNT(P.URID),SUM(P.amount),P.method, MIN(PP.recdate+0) > 19980501000000   AS IsNew FROM t1 AS P JOIN t1 as PP WHERE P.URID = PP.URID GROUP BY method,IsNew;
87
87
 
88
88
drop table t1;
168
168
#  KEY votes (votes)
169
169
#);
170
170
#
171
 
#--error ER_WARN_DATA_TRUNCATED
 
171
#--error 1265
172
172
#INSERT INTO t1 VALUES (1,0,0,'','normal','','2000-02-10 09:25:12',20000321114747,'','','Linux','P1','TestProduct','PC',3,'other','TestComponent','','M1',0,'',0);
173
173
#INSERT INTO t1 VALUES (9,0,0,'','enhancement','','2000-03-10 11:49:36',20000321114747,'','','All','P5','AAAAA','PC',3,'2.00 CD - Pre','BBBBBBBBBBBBB - conversion','','',0,'',0);
174
174
#INSERT INTO t1 VALUES (10,0,0,'','enhancement','','2000-03-10 18:10:16',20000321114747,'','','All','P4','AAAAA','PC',3,'2.00 CD - Pre','BBBBBBBBBBBBB - conversion','','',0,'',0);
283
283
INSERT INTO t1 VALUES ('A'),('B'),('A'),('B'),('A'),('B'),(NULL),('a'),('b'),(NULL),('A'),('B'),(NULL);
284
284
SELECT a FROM t1 GROUP BY a;
285
285
SELECT a,count(*) FROM t1 GROUP BY a;
286
 
SELECT a FROM t1 GROUP BY a;
287
 
SELECT a,count(*) FROM t1 GROUP BY a;
288
 
SELECT a FROM t1 GROUP BY 1;
289
 
SELECT a,count(*) FROM t1 GROUP BY 1;
 
286
SELECT a FROM t1 GROUP BY binary a;
 
287
SELECT a,count(*) FROM t1 GROUP BY binary a;
 
288
SELECT binary a FROM t1 GROUP BY 1;
 
289
SELECT binary a,count(*) FROM t1 GROUP BY 1;
290
290
# Do the same tests with MyISAM temporary tables
291
291
SELECT a FROM t1 GROUP BY a;
292
292
SELECT a,count(*) FROM t1 GROUP BY a;
293
 
SELECT a FROM t1 GROUP BY a;
294
 
SELECT a,count(*) FROM t1 GROUP BY a;
295
 
SELECT a FROM t1 GROUP BY 1;
296
 
SELECT a,count(*) FROM t1 GROUP BY 1;
 
293
SELECT a FROM t1 GROUP BY binary a;
 
294
SELECT a,count(*) FROM t1 GROUP BY binary a;
 
295
SELECT binary a FROM t1 GROUP BY 1;
 
296
SELECT binary a,count(*) FROM t1 GROUP BY 1;
297
297
drop table t1;
298
298
 
299
299
#
400
400
insert into t2 values (1,3),(3,1),(2,2),(1,1);
401
401
select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b;
402
402
select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b ORDER BY NULL;
403
 
--sorted_result
404
403
explain select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b;
405
 
--sorted_result
406
404
explain select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b ORDER BY NULL;
407
405
drop table t1,t2;
408
406
 
512
510
 
513
511
delete from t2  where a = 2 and b = 'val-2' order by a,b,c,d limit 30;
514
512
 
515
 
--replace_column 4 # 7 # 9 # 10 #
516
513
explain select c from t2 where a = 2 and b = 'val-2' group by c;
517
514
select c from t2 where a = 2 and b = 'val-2' group by c;
518
515
drop table t1,t2;
750
747
select * from t1 group by f1;
751
748
select * from t1 group by f2;
752
749
select * from t1 group by f1, f2;
753
 
select t1.f1,t.* from t1, t1 t where t1.f1 >= 0 group by 1;
 
750
select t1.f1,t.* from t1, t1 t group by 1;
754
751
drop table t1;
755
752
 
756
753
#