3 # Do some basic checks on a table.
5 # FIXME: Do not write the statements and results, if SQL return code = 0
6 # and result set like expected. Write a message, that all is like
9 # All SELECTs are so written, that we get my_value = 1, when everything
13 --source suite/parts/inc/partition_layout.inc
15 ####### Variations with multiple records
16 # Select on empty table
17 SELECT COUNT(*) = 0 AS my_value FROM t1;
18 # (mass) Insert of $max_row records
19 eval INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND $max_row;
21 eval SELECT (COUNT(*) = $max_row) AND (MIN(f1) = 1) AND (MAX(f1) = $max_row)
23 # DEBUG SELECT COUNT(*),MIN(f1),MAX(f1) FROM t1;
24 # (mass) Update $max_row_div4 * 2 + 1 records
25 eval UPDATE t1 SET f1 = f1 + $max_row
26 WHERE f1 BETWEEN $max_row_div2 - $max_row_div4 AND $max_row_div2 + $max_row_div4;
28 eval SELECT (COUNT(*) = $max_row) AND (MIN(f1) = 1) AND (MAX(f1) = $max_row_div2 + $max_row_div4 + $max_row )
30 # DEBUG SELECT COUNT(*),MIN(f1),MAX(f1) FROM t1;
31 # (mass) Delete $max_row_div4 * 2 + 1 records
33 WHERE f1 BETWEEN $max_row_div2 - $max_row_div4 + $max_row AND $max_row_div2 + $max_row_div4 + $max_row;
35 eval SELECT (COUNT(*) = $max_row - $max_row_div4 - $max_row_div4 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = $max_row)
37 # DEBUG SELECT COUNT(*),MIN(f1),MAX(f1) FROM t1;
39 ####### Variations with single records
40 # Insert one record at beginning
41 INSERT INTO t1 SET f1 = 0 , f2 =
'#######';
43 SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 =
'#######';
44 # Insert one record at end
45 eval INSERT INTO t1 SET f1 = $max_row + 1, f2 =
'#######';
47 eval SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = $max_row + 1 AND f2 =
'#######';
49 eval UPDATE t1 SET f1 = $max_row + 2, f2 =
'ZZZZZZZ'
50 WHERE f1 = 0 AND f2 =
'#######';
52 eval SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = $max_row + 2 AND f2 =
'ZZZZZZZ';
53 # Bug #15968: Partitions: crash when INSERT with f1 = -1 into PARTITION BY HASH(f1)
54 eval UPDATE t1 SET f1 = 0 - 1, f2 =
'ZZZZZZZ'
55 WHERE f1 = $max_row + 1 AND f2 =
'#######';
57 SELECT COUNT(*) AS my_value FROM t1 WHERE f1 = 0 - 1 AND f2 = 'ZZZZZZZ';
59 eval DELETE FROM t1 WHERE f1 = $max_row + 2 AND f2 =
'ZZZZZZZ';
60 DELETE FROM t1 WHERE f1 = 0 - 1 AND f2 =
'ZZZZZZZ';
62 SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 =
'ZZZZZZZ';
66 # Select on empty table
67 SELECT COUNT(*) = 0 AS my_value FROM t1;