I want to set a non-zero default for an unsigned integer field and also have
that field auto increment. Ideally, I'd like to use something like:
drop table if exists foo;
CREATE TABLE foo (
id int unsigned DEFAULT 2415919104 NOT NULL AUTO_INCREMENT,
UNIQUE id (id),
insert foo (value) values ("zero");
insert foo (value) values ("one");
select * from foo;
and have MySQL display:
Instead it displays:
I see in the docs where it says "AUTO_INCREMENT sequences begin with 1".
Shouldn't it therefore be an error or warning to use both DEFAULT and
AUTO_INCREMENT in the same column definition? Failing that, why does
AUTO_INCREMENT impose this seemingly arbitrary restriction on where it can
start counting from?
Is there some way I can get the behavior I want? Generally, what I want is
to be able to have the id column start at some non-zero value and get
incremented every time I insert a new row into the table without having to
query some values from the server or explicitly set that column, since I'll
be loading data in from CSV files and won't easily have the luxury of
computing column values.
Skip Montanaro | http://www.mojam.com/
skip@stripped | http://www.musi-cal.com/