Debian Codegraph @

mysql-test/suite/storage_engine/autoinc_secondary.test

raw
1 #
2 # AUTO_INCREMENT on a secondary column in a multi-part key
3 #
4
5 --source have_engine.inc
6 --source have_default_index.inc
7
8 --disable_warnings
9 DROP TABLE IF EXISTS t1;
10 --enable_warnings
11
12 #
13 # AUTO_INCREMENT is the primary column in a multiple-column index
14 #
15
16 --let $create_definition = a $int_col AUTO_INCREMENT, b $char_col, PRIMARY KEY (a,b)
17 --source create_table.inc
18 if ($mysql_errname)
19 {
20 --let $functionality = Multi-part keys or PK or AUTO_INCREMENT (on a primary column)
21 --source unexpected_result.inc
22 }
23 if (!$mysql_errname)
24 {
25 INSERT INTO t1 (b) VALUES ('a'),('b'),('b'),('c'),('a');
26 SELECT LAST_INSERT_ID();
27 --sorted_result
28 SELECT a,b FROM t1;
29 DROP TABLE t1;
30 }
31
32 #
33 # AUTO_INCREMENT is the secondary column in a multiple-column index
34 #
35
36 --let $create_definition = a $char_col, b $int_col AUTO_INCREMENT, PRIMARY KEY (a,b)
37 --source create_table.inc
38 if ($mysql_errname)
39 {
40 --let $functionality = Multi-part keys or PK or AUTO_INCREMENT (on a secondary column)
41 --source unexpected_result.inc
42 }
43 if (!$mysql_errname)
44 {
45 INSERT INTO t1 (a) VALUES ('a'),('b'),('b'),('c'),('a');
46 SELECT LAST_INSERT_ID();
47 --sorted_result
48 SELECT a,b FROM t1;
49 DROP TABLE t1;
50 }
51
52 # AUTO_INCREMENT is the secondary column in a multiple-column index,
53 # and primary in another index
54 #
55
56 --let $create_definition = a $char_col, b $int_indexed_col AUTO_INCREMENT, PRIMARY KEY (a,b), $default_index(b)
57 --source create_table.inc
58 if ($mysql_errname)
59 {
60 --let $functionality = Multi-part keys or AUTO_INCREMENT (on the secondary column) or multiple keys
61 --source unexpected_result.inc
62 }
63 if (!$mysql_errname)
64 {
65 INSERT INTO t1 (a) VALUES ('a'),('b'),('b'),('c'),('a');
66 SELECT LAST_INSERT_ID();
67 --sorted_result
68 SELECT a,b FROM t1;
69 DROP TABLE t1;
70 }
71
72 --source cleanup_engine.inc
73