← Back to team overview

drizzle-discuss team mailing list archive

strict auto-inc

 

In fixing up the strict_autoinc tests, I've come across a "umm... what
should our behaviour be".

Of course, this is around the much loved auto_increment.


currently, MySQL behaves like this:

drop table if exists t1;
set @org_mode=@@sql_mode;
create table t1
(
`a` tinyint(4) NOT NULL auto_increment,
primary key (`a`)
) engine = 'MYISAM'  ;
set @@sql_mode='strict_all_tables';
insert into t1 values(1000);
ERROR 22003: Out of range value for column 'a' at row 1
select count(*) from t1;
count(*)
0
set auto_increment_increment=1000;
set auto_increment_offset=700;
insert into t1 values(null);
ERROR 22003: Out of range value for column 'a' at row 1
select count(*) from t1;
count(*)
0
set @@sql_mode=@org_mode;
insert into t1 values(null);
Warnings:
Warning 1264    Out of range value for column 'a' at row 1
select * from t1;
a
127
drop table t1;

drop table if exists t1;
create table t1
(
`a` INT NOT NULL auto_increment,
primary key (`a`)
) engine = 'MYISAM'  ;
insert into t1 values(1000);
select count(*) from t1;
count(*)
1
set auto_increment_increment=1000;
set auto_increment_offset=700;
insert into t1 values(null);
select count(*) from t1;
count(*)
2
insert into t1 values(null);
select * from t1;
a
1000
1700
2700
drop table t1;


Personally, I think our current behaviour is good - it "just works".

What are the thoughts of others?

P.S. if anyone can solve the problem where my iPod stops some tracks before
they've finished they'll get a cookie (or other such good thing)
-- 
Stewart Smith



Follow ups