Debian Codegraph @

mysql-test/suite/ndb/t/ndb_autoinc.test

raw
1 -- source include/have_ndb.inc
2
3 CREATE TABLE t1 (
4 id INT AUTO_INCREMENT,
5 PRIMARY KEY(id)
6 ) ENGINE=NDBCLUSTER;
7
8 # Test For bug#30417
9 --error ER_CANT_CREATE_TABLE
10 CREATE TABLE t2 (
11 id INT AUTO_INCREMENT,
12 KEY(id)
13 ) ENGINE=NDBCLUSTER;
14 SHOW WARNINGS;
15
16 SHOW TABLES;
17
18 CREATE TABLE t3 (
19 id INT AUTO_INCREMENT,
20 KEY(id)
21 ) ENGINE=MYISAM;
22
23 --error ER_CANT_CREATE_TABLE
24 ALTER TABLE t3
25 ENGINE NDBCLUSTER;
26 SHOW WARNINGS;
27
28 --disable_warnings
29 SHOW CREATE TABLE t3;
30 --enable_warnings
31
32 ALTER TABLE t3
33 ADD PRIMARY KEY (id);
34
35 --disable_warnings
36 SHOW CREATE TABLE t3;
37 --enable_warnings
38
39 DROP TABLE t1, t3;
40
41 set @@auto_increment_increment=4;
42 set @@auto_increment_offset=1;
43 set @@ndb_autoincrement_prefetch_sz=2;
44 create table t1 (a int unsigned not null primary key auto_increment)
45 engine ndb;
46 insert into t1 values ();
47 insert into t1 values (2);
48 insert into t1 values ();
49 insert into t1 values ();
50 select * from t1 order by a;
51 drop table t1;
52
53
54
55 set @@auto_increment_increment=2;
56 set @@auto_increment_offset=1;
57
58 --echo First look at default SE behaviour on manual insert unaligned with
59 --echo offset + step
60
61 create table t1 (a int unsigned not null primary key auto_increment);
62 show variables like 'LAST_INSERT_ID';
63 insert into t1 values();
64 show variables like 'LAST_INSERT_ID';
65 insert into t1 values(18);
66 show variables like 'LAST_INSERT_ID';
67 insert into t1 values();
68 show variables like 'LAST_INSERT_ID';
69 insert into t1 values();
70 show variables like 'LAST_INSERT_ID';
71 insert into t1 values();
72 show variables like 'LAST_INSERT_ID';
73 insert into t1 values(22);
74 show variables like 'LAST_INSERT_ID';
75 insert into t1 values();
76 show variables like 'LAST_INSERT_ID';
77 insert into t1 values(28);
78 show variables like 'LAST_INSERT_ID';
79 insert into t1 values();
80 show variables like 'LAST_INSERT_ID';
81 insert into t1 values();
82 show variables like 'LAST_INSERT_ID';
83 select * from t1 order by a;
84 drop table t1;