1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
#
# auto-increment-offset and auto-increment-increment
#
--source have_engine.inc
--source have_default_index.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
# auto_increment_offset
SET auto_increment_offset = 200;
--let $create_definition = a $int_indexed_col AUTO_INCREMENT, b $char_col, $default_index(a)
--source create_table.inc
if ($mysql_errname)
{
--let $functionality = AUTO_INCREMENT
--source unexpected_result.inc
}
if (!$mysql_errname)
{
# If auto_increment_offset is greater than auto_increment_increment,
# the offset is ignored
INSERT INTO t1 (a,b) VALUES (NULL,'a'),(NULL,'b'),(NULL,'c');
SELECT LAST_INSERT_ID();
--sorted_result
SELECT a,b FROM t1;
# auto_increment_increment
SET auto_increment_increment = 300;
# offset should not be ignored anymore
INSERT INTO t1 (a,b) VALUES (NULL,'d'),(NULL,'e'),(NULL,'f');
SELECT LAST_INSERT_ID();
--sorted_result
SELECT a,b FROM t1;
SET auto_increment_increment = 50;
INSERT INTO t1 (a,b) VALUES (NULL,'g'),(NULL,'h'),(NULL,'i');
SELECT LAST_INSERT_ID();
--sorted_result
SELECT a,b FROM t1;
DROP TABLE t1;
}
# offset is greater than the max value
SET auto_increment_increment = 500;
SET auto_increment_offset = 300;
--let $create_definition = a TINYINT $default_col_indexed_opts AUTO_INCREMENT, $default_index(a)
--source create_table.inc
if ($mysql_errname)
{
--let $functionality = AUTO_INCREMENT
--source unexpected_result.inc
}
if (!$mysql_errname)
{
INSERT INTO t1 (a) VALUES (NULL);
SELECT LAST_INSERT_ID();
--sorted_result
SELECT a FROM t1;
DROP TABLE t1;
}
--source cleanup_engine.inc
|