116 lines
2.7 KiB
Plaintext
116 lines
2.7 KiB
Plaintext
DROP TABLE IF EXISTS t1,t2,t3;
|
|
USE test;
|
|
CREATE TABLE t1 (
|
|
id INT AUTO_INCREMENT,
|
|
PRIMARY KEY(id)
|
|
) ENGINE=NDBCLUSTER;
|
|
CREATE TABLE t2 (
|
|
id INT AUTO_INCREMENT,
|
|
KEY(id)
|
|
) ENGINE=NDBCLUSTER;
|
|
ERROR HY000: Got error 4335 'Only one autoincrement column allowed per table. Having a table without primary key uses an autoincr' from NDBCLUSTER
|
|
SHOW TABLES;
|
|
Tables_in_test
|
|
t1
|
|
CREATE TABLE t3 (
|
|
id INT AUTO_INCREMENT,
|
|
KEY(id)
|
|
) ENGINE=MYISAM;
|
|
ALTER TABLE t3
|
|
ENGINE NDBCLUSTER;
|
|
ERROR HY000: Got error 4335 'Only one autoincrement column allowed per table. Having a table without primary key uses an autoincr' from NDBCLUSTER
|
|
SHOW CREATE TABLE t3;
|
|
Table Create Table
|
|
t3 CREATE TABLE `t3` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
KEY `id` (`id`)
|
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
|
ALTER TABLE t3
|
|
ADD PRIMARY KEY (id);
|
|
SHOW CREATE TABLE t3;
|
|
Table Create Table
|
|
t3 CREATE TABLE `t3` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
PRIMARY KEY (`id`),
|
|
KEY `id` (`id`)
|
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
|
DROP TABLE t1, t3;
|
|
End of 5.1 tests
|
|
set @@auto_increment_increment=4;
|
|
set @@auto_increment_offset=1;
|
|
set @@ndb_autoincrement_prefetch_sz=2;
|
|
create table t1 (a int unsigned not null primary key auto_increment)
|
|
engine ndb;
|
|
insert into t1 values ();
|
|
insert into t1 values (2);
|
|
insert into t1 values ();
|
|
insert into t1 values ();
|
|
select * from t1 order by a;
|
|
a
|
|
1
|
|
2
|
|
5
|
|
9
|
|
drop table t1;
|
|
set @@auto_increment_increment=2;
|
|
set @@auto_increment_offset=1;
|
|
First look at default SE behaviour on manual insert unaligned with
|
|
offset + step
|
|
create table t1 (a int unsigned not null primary key auto_increment);
|
|
show variables like 'LAST_INSERT_ID';
|
|
Variable_name Value
|
|
last_insert_id 9
|
|
insert into t1 values();
|
|
show variables like 'LAST_INSERT_ID';
|
|
Variable_name Value
|
|
last_insert_id 1
|
|
insert into t1 values(18);
|
|
show variables like 'LAST_INSERT_ID';
|
|
Variable_name Value
|
|
last_insert_id 1
|
|
insert into t1 values();
|
|
show variables like 'LAST_INSERT_ID';
|
|
Variable_name Value
|
|
last_insert_id 19
|
|
insert into t1 values();
|
|
show variables like 'LAST_INSERT_ID';
|
|
Variable_name Value
|
|
last_insert_id 21
|
|
insert into t1 values();
|
|
show variables like 'LAST_INSERT_ID';
|
|
Variable_name Value
|
|
last_insert_id 23
|
|
insert into t1 values(22);
|
|
show variables like 'LAST_INSERT_ID';
|
|
Variable_name Value
|
|
last_insert_id 23
|
|
insert into t1 values();
|
|
show variables like 'LAST_INSERT_ID';
|
|
Variable_name Value
|
|
last_insert_id 25
|
|
insert into t1 values(28);
|
|
show variables like 'LAST_INSERT_ID';
|
|
Variable_name Value
|
|
last_insert_id 25
|
|
insert into t1 values();
|
|
show variables like 'LAST_INSERT_ID';
|
|
Variable_name Value
|
|
last_insert_id 29
|
|
insert into t1 values();
|
|
show variables like 'LAST_INSERT_ID';
|
|
Variable_name Value
|
|
last_insert_id 31
|
|
select * from t1 order by a;
|
|
a
|
|
1
|
|
18
|
|
19
|
|
21
|
|
22
|
|
23
|
|
25
|
|
28
|
|
29
|
|
31
|
|
drop table t1;
|