2
# this is a test for error 1032 in count(distinct) + group by, introduced in
7
DROP TABLE IF EXISTS t1, t2;
10
CREATE TABLE t1 (id INTEGER, grp TINYINT, id_rev INTEGER);
13
SET @rnd_max= 2147483647;
18
SET @id = CAST(@rnd * @rnd_max AS UNSIGNED);
19
SET @id_rev= @rnd_max - @id;
20
SET @grp= CAST(127.0 * @rnd AS UNSIGNED);
21
INSERT INTO t1 (id, grp, id_rev) VALUES (@id, @grp, @id_rev);
24
set @@read_buffer_size=2*1024*1024;
25
CREATE TABLE t2 SELECT * FROM t1;
26
INSERT INTO t1 (id, grp, id_rev) SELECT id, grp, id_rev FROM t2;
27
INSERT INTO t2 (id, grp, id_rev) SELECT id, grp, id_rev 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
INSERT INTO t1 (id, grp, id_rev) SELECT id, grp, id_rev FROM t2;
35
INSERT INTO t2 (id, grp, id_rev) SELECT id, grp, id_rev FROM t1;
36
INSERT INTO t1 (id, grp, id_rev) SELECT id, grp, id_rev FROM t2;
37
INSERT INTO t2 (id, grp, id_rev) SELECT id, grp, id_rev FROM t1;
38
INSERT INTO t1 (id, grp, id_rev) SELECT id, grp, id_rev FROM t2;
39
INSERT INTO t2 (id, grp, id_rev) SELECT id, grp, id_rev FROM t1;
40
INSERT INTO t1 (id, grp, id_rev) SELECT id, grp, id_rev FROM t2;
41
INSERT INTO t2 (id, grp, id_rev) SELECT id, grp, id_rev FROM t1;
42
INSERT INTO t1 (id, grp, id_rev) SELECT id, grp, id_rev FROM t2;
43
INSERT INTO t2 (id, grp, id_rev) SELECT id, grp, id_rev FROM t1;
47
SELECT COUNT(*) FROM t1;
49
# As t1 contains random numbers, results are different from test to test.
50
# That's okay, because we test only that select doesn't yield an
51
# error. Note, that --disable_result_log doesn't suppress error output.
54
SELECT COUNT(DISTINCT id) FROM t1 GROUP BY grp;
58
set @@read_buffer_size=default;