~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/count_distinct3.test

  • Committer: Monty Taylor
  • Date: 2008-09-16 00:00:48 UTC
  • mto: This revision was merged to the branch mainline in revision 391.
  • Revision ID: monty@inaugust.com-20080916000048-3rvrv3gv9l0ad3gs
Fixed copyright headers in drizzled/

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#
2
 
# this is a test for error 1032 in count(distinct) + group by, introduced in 
3
 
# mysql-4.1
4
 
#
5
 
 
6
 
--disable_warnings
7
 
DROP TABLE IF EXISTS t1, t2;
8
 
--enable_warnings
9
 
 
10
 
CREATE TABLE t1 (id INTEGER, grp int, id_rev INTEGER);
11
 
 
12
 
--disable_query_log
13
 
SET @rnd_max= 2147483647;
14
 
let $1 = 1000;
15
 
begin;
16
 
while ($1)
17
 
{
18
 
  SET @rnd= RAND();
19
 
  SET @id = @rnd * @rnd_max;
20
 
  SET @id_rev= @rnd_max - @id;
21
 
  SET @grp= 127.0 * @rnd;
22
 
  INSERT INTO t1 (id, grp, id_rev) VALUES (@id, @grp, @id_rev); 
23
 
  dec $1;
24
 
}
25
 
commit;
26
 
set @@read_buffer_size=2*1024*1024;
27
 
CREATE TABLE t2 SELECT * FROM t1;
28
 
INSERT INTO t1 (id, grp, id_rev) SELECT id, grp, id_rev FROM t2;
29
 
INSERT INTO t2 (id, grp, id_rev) SELECT id, grp, id_rev FROM t1;
30
 
INSERT INTO t1 (id, grp, id_rev) SELECT id, grp, id_rev FROM t2;
31
 
INSERT INTO t2 (id, grp, id_rev) SELECT id, grp, id_rev FROM t1;
32
 
INSERT INTO t1 (id, grp, id_rev) SELECT id, grp, id_rev FROM t2;
33
 
INSERT INTO t2 (id, grp, id_rev) SELECT id, grp, id_rev FROM t1;
34
 
DROP TABLE t2;
35
 
--enable_query_log
36
 
 
37
 
SELECT COUNT(*) FROM t1;
38
 
 
39
 
# As t1 contains random numbers, results are different from test to test. 
40
 
# That's okay, because we test only that select doesn't yield an
41
 
# error. Note, that --disable_result_log doesn't suppress error output.
42
 
 
43
 
--disable_result_log
44
 
SELECT COUNT(DISTINCT id) FROM t1 GROUP BY grp;
45
 
--enable_result_log
46
 
DROP TABLE t1;
47
 
 
48
 
set @@read_buffer_size=default;
49
 
 
50
 
# End of 4.1 tests