Re: Duplicate serial in Informix 7.2.3
Posted in 2007
On Thu, 2007-07-26 at 03:25 +0000, Ian Michael Gumby wrote: > [...] a serial datatype > guarantees uniqueness [...] > [...] [serial values] were intended to be unqiue [...] Those are two very different statements, and the first one is, as stated, incorrect. In general, a serial column is not per se unique. You "accidentally" get unique values if you only ever insert 0 into it, but that uniqueness is not guaranteed or enforced by the serial type. I agree with the second statement that serial values are *intended* to be unique. That much is clear from how they behave. However, to get a uniqueness guarantee, you need an additional uniqueness constraint. Of course, in the real world, one usually uses a serial column to invent a primary key where the data does not have an inherent primary key, so you're likely to add a unique index or primary key constraint for the serial column anyway. Maybe I'm splitting hairs here, but sometimes it's better to be too precise. -- Carsten Haese http://informixdb.sourceforge.net