Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email firstname.lastname@example.org
AW: LOADERCLI reset SERIAL columns
From: Schildberg, Steffen (steffen.schildbergsap.com)
Date: Tue Mar 21 2006 - 04:27:48 CST
Rosa Lago [mailto:rosa.lagogmail.com] wrote
> I have a problem with loadercli. After import catalog and data for
> the entire database using loadercli all columns that are of type
> serial(N) are reset to N when the import finish, so when I try to
> insert new rows for a table whose primary key is of type SERIAL(N)
> appears a duplicate key error. I have deleted the rows whose keys are
> N to test that it was the problem and in fact the problem is that.
> Can somebody help me?
Data type SERIAL is equivalent to FIXED(10) DEFAULT SERIAL (N).
So, to correct the behavior you could drop the DEFAULT SERIAL for every
that uses SERIAL and recreate it - a simple ALTER doesn't work.
An example would be the following definition (on the target system):
CREATE TABLE example (c1 SERIAL(1), c2 CHAR(10))
Now drop the DEFAULT:
ALTER TABLE example COLUMN c1 DROP DEFAULT
and recreate it with the value = highest inserted value + 1:
ALTER TABLE example COLUMN c1 ADD DEFAULT SERIAL (<highest + 1>)
This should solve your problem. It sets the number generator to an
above the last/highest inserted.
As this is a shortcoming of the Loader we'll correct it to avoid those
in the future.
Sorry for any inconvenience.
SAP Labs Berlin
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb