Hello.

On Sun 2002-12-29 at 11:26:01 +0100, [EMAIL PROTECTED] wrote:
> Hello,
> I had a problem few days ago. I'm doing my questbook, and I were thinking
> what would hapen if I delete some row. Now I know, nothing. I had one column
> ID (auto_increment) in my table. I wanted it to be one by one even after
> deleting, so I changed it by myself. But then (after deleting the last ID
> was 17, and before 32), next ID was 33, not 18. Is there any function, which
> can change it? If not, mayby you'll try to do something like that. It's
> right, I can do it by myself not using auto_increment, and giving the ID
> number MAX(ID)+1, but if there is such function it would be realy fine.

What you describe was the behaviour in older MySQL versions and it has
been changed because primary keys should never be reused. Never.

If you need it to have no holes, you are abusing the primary key for
something which it is not intended for (visible entry numbering?).

So, yes, you have to either implement it yourself, or, what I would
recommend, have a seperate column for it or calculate it in your
application, whatever makes most sense for your use.

HTH,

        Benjamin.


PS: AFAIK, InnoDB still has the "old" behaviour. Anyhow, it will
    change soon enough.


-- 
[EMAIL PROTECTED]

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to