Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

New link id replacing deleted id?

Quote Reply
New link id replacing deleted id?
If i delete links 1-10 so the first link id is 11, and then I add a new link, it gets assigned the new link id of 12.

Shouldn't it get the first available or empty link id, ie 1?

Quote Reply
Re: New link id replacing deleted id? In reply to
In Reply To:
Shouldn't it get the first available or empty link id, ie 1?
Nope...not with an AUTO-INCREMENTING field. Wink

Regards,

Eliot Lee
Quote Reply
Re: New link id replacing deleted id? In reply to
Thanks! So I wont worry then :)

Quote Reply
Re: New link id replacing deleted id? In reply to
Eliot is right.

The reason is, the Autoincrement is designed to return the NEXT AVAILABLE, which is 1 more than the largest record in the database. This is one reason why the field has to be indexed.

It used to be that if you had 99 records in your database, then deleted record 99, the next record inserted would be 99 (reusing the ID). Now, it will be 100. (I forget which version of MySQL that started with.) But the idea is to return a UNIQUE value.

If you "EMPTY" a database, the values start back over at 1.


PUGDOGŪ
PUGDOGŪ Enterprises, Inc.
FAQ: http://postcards.com/FAQ