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

85 lines
1.8 KiB
Plaintext

-- source include/have_ndb.inc
CREATE TABLE t1 (
id INT AUTO_INCREMENT,
PRIMARY KEY(id)
) ENGINE=NDBCLUSTER;
# Test For bug#30417
--error ER_CANT_CREATE_TABLE
CREATE TABLE t2 (
id INT AUTO_INCREMENT,
KEY(id)
) ENGINE=NDBCLUSTER;
SHOW WARNINGS;
SHOW TABLES;
CREATE TABLE t3 (
id INT AUTO_INCREMENT,
KEY(id)
) ENGINE=MYISAM;
--error ER_CANT_CREATE_TABLE
ALTER TABLE t3
ENGINE NDBCLUSTER;
SHOW WARNINGS;
--disable_warnings
SHOW CREATE TABLE t3;
--enable_warnings
ALTER TABLE t3
ADD PRIMARY KEY (id);
--disable_warnings
SHOW CREATE TABLE t3;
--enable_warnings
DROP TABLE t1, t3;
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;
drop table t1;
set @@auto_increment_increment=2;
set @@auto_increment_offset=1;
--echo First look at default SE behaviour on manual insert unaligned with
--echo offset + step
create table t1 (a int unsigned not null primary key auto_increment);
show variables like 'LAST_INSERT_ID';
insert into t1 values();
show variables like 'LAST_INSERT_ID';
insert into t1 values(18);
show variables like 'LAST_INSERT_ID';
insert into t1 values();
show variables like 'LAST_INSERT_ID';
insert into t1 values();
show variables like 'LAST_INSERT_ID';
insert into t1 values();
show variables like 'LAST_INSERT_ID';
insert into t1 values(22);
show variables like 'LAST_INSERT_ID';
insert into t1 values();
show variables like 'LAST_INSERT_ID';
insert into t1 values(28);
show variables like 'LAST_INSERT_ID';
insert into t1 values();
show variables like 'LAST_INSERT_ID';
insert into t1 values();
show variables like 'LAST_INSERT_ID';
select * from t1 order by a;
drop table t1;