1
# Bug #958 a big table without indices and select with group by doesnt work
2
# this is a test for error 1032 in count(distinct) + group by, introduced in
6
--source include/big_test.inc
9
DROP TABLE IF EXISTS t1, t2;
12
CREATE TABLE t1 (id INTEGER, grp TINYINT, id_rev INTEGER);
15
SET @rnd_max= 2147483647;
20
SET @id = CAST(@rnd * @rnd_max AS UNSIGNED);
21
SET @id_rev= @rnd_max - @id;
22
SET @grp= CAST(127.0 * @rnd AS UNSIGNED);
23
INSERT INTO t1 (id, grp, id_rev) VALUES (@id, @grp, @id_rev);
27
# We increase the size of t1 here.
28
SET @orig_myisam_sort_buffer_size = @@session.myisam_sort_buffer_size;
29
SET session myisam_sort_buffer_size=20000000;
31
SELECT A.id, A.grp, A.id_rev
34
(SELECT * FROM t1 B LIMIT 100) B,
35
(SELECT * FROM t1 Z LIMIT 42) Z;
38
SELECT COUNT(*) FROM t1;
40
# As t1 contains random numbers, results are different from test to test.
41
# That's okay, because we test only that select doesn't yield an
42
# error. Note, that --disable_result_log doesn't suppress error output.
44
SELECT COUNT(DISTINCT id) FROM t1 GROUP BY grp;
47
--echo # Begin cleanup
48
SET session myisam_sort_buffer_size = @orig_myisam_sort_buffer_size;