Out of Range Table
I looked into a problem that occurred recently when adding observations to the spectra
table over break. The error message was
This was due to using a normal INT
type for the index. The fix is quite simple in MySQL, you can change the type using the command:
However, spec_id
is also auto incrementing and the PRIMARY KEY for
my table. Here is the description of spec_id
BEFORE ALTERing the
TABLE:
Since there is already a PRIMARY KEY set (spec_id), MySQL will produce an
error if PRIMARY KEY is specified when attempting to MODIFY the TABLE.
Fortunately, this does not matter — the spec_id column will
remain the primary key even if PRIMARY KEY is not specified. However, AUTO_INCREMENT
does need to be specified when altering the column.
In my specific case the command used to change my MySQL column
from an INT
type to BIGINT
was
which resulted in
Using BIGINT
for the type will allow for up to 9 Quadrillion rows in the table! That should last for a while.