Re: Adding a serial column to a table. (fwd)
Posted in 1996
NO! It is not a bug. A SERIAL column needs a unique constraint (unique index, primary key constraint) on it to enforce uniqueness. If you do not have a unique index on the SERIAL column, you can insert duplicate values in that column. Similarly, you can insert non-zero values into a SERIAL column and those values are inserted verbatim. You will get a duplicate value error if you have a unique constraint on the column; you won't if you don't. In addition, that is the way it always has been (since 1.10.00 ISQL, say 1986 or thereabouts), and that is the way it probably always will be. Yours, Jonathan Leffler (johnl@informix.com) #include <disclaimer.h> }From: chida@psi.ernet.in }Date: Fri, 8 Mar 96 10:35:37 GMT }X-Informix-List-Id: <list.8970> } }> > I'd like to add a serial column to a large (10 million rows) table and I want }> > the numbering to be as if it was always there (1-10,000,000) }> > I can figure out how to do it with load and unload, but this takes forever. }> > Is there a faster method using SQL / 4GL? }> }> Add it as an integer then alter the table and make the column a serial. } } NEW BUG IN INFORMIX } } I found it interesting and tried in my INFORMIX-SE V5.x } I created a table of 2 columns, one char(20), one integer. Added 4 rows } with 2 rows duplicate of the first 2. Then altered the table to change } integer to serial. While building the table got error message as } cannot create index -- duplicate row } } But INFOMIX altered the table with serial column without unique index. }and the table contains duplicate values for serial column. } } Isn't it a bug?