Re: Serial field and insert, maybe a very stupid question
Posted in 2008
You have to add a unique index or primary key or unique constraint on the
serial field for it to require uniqueness. The data type itself ONLY
guarantees that if you insert a zero it will replace that with the next
sequential number.
Art
On Wed, Aug 6, 2008 at 8:27 AM, Jörg Volz <Joerg@it-volz.de> wrote:
> Hy,
>
> I have two identical tables on two different IDS 10 Servers.
> Both tables look exactly the same, structure like that:
>
> create table tblSomething> {
> idxodbc serial,
> Textfield char(20)
> }
>
> Both tables have the same data, 12 rows with idbxodbc from 1 to 12 and some
> text in each row.
>
> 1 SomeText
> 2 Moretext
> ...
> 12 lasttext
>
> Now I did an
>
> INSERT INTO tbSomething -- working on Server1
> SELECT *
> FROM database@Server2:tblSomething>
> I expected to get a hit on my finger for writing exactly the same Values in
> a serial defined field, but the Insert just ran and I ended up with two rows
> with idxodbc=1, two rows with idxodbc=2 and so forth...
>
> 1 SomeText
> 1 SomeText
> 2 Moretext
> 2 Moretext
> ...
> 12 lasttext
> 12 lasttext
>
> Is this normal behaviour? I am very surprised, but it has been a long time
> since I tried to mess up with serial defined fields. (once with Online 4.x
> when I started Informix)
>
>
> regards,
> Joerg Volz
>
>
> IT Handel und Beratung Jörg Volz
> Bernhard-Früh-Str. 7
> 77855 Achern
> GERMANY
>
> Tel: 07841-681651
> Fax: 07841-681654
> Mobil: 0170-2989757
> Ust-ID: DE201383541
>
> http://www.it-volz.de
>
> _______________________________________________
> Informix-list mailing list
> Informix-list@iiug.org
> http://www.iiug.org/mailman/listinfo/informix-list
>
>
--
Art S. Kagel
Oninit (www.oninit.com)
IIUG Board of Directors (art@iiug.org)
Disclaimer: Please keep in mind that my own opinions are my own opinions and
do not reflect on my employer, Oninit, the IIUG, nor any other organization
with which I am associated either explicitly or implicitly. Neither do those
opinions reflect those of other individuals affiliated with any entity with
which I am affiliated nor those of the entities themselves.