List:General Discussion« Previous MessageNext Message »
From:Davor Cengija Date:May 22 1999 2:11pm
Subject:Re: auto_increment after deleting last ID
View as plain text  
On Sat, 22 May 1999, Paul DuBois wrote:

>>       i have a table with auto_increment field (and lets say 20
>>       rows). if i delete row 10, and then insert a new row, it gets
>>       id=21 which is ok. but if i delete the row the the highest id
>>       value (here 21) and then insert a new on, it gets id=21.
>>
>>       should'n it be 22?
>
>
>No.  The new id is always one more than the largest id currently in
>the table.  If you delete all the rows, the sequence will start over
>at 1.
>
>This behavior will change when 3.23.x comes out, when you'll be able
>to get strictly increasing sequences with no reuse.

       ok, so i need an additional table or whatever with a field
       which will contain just the highest number reached by
       auto_increment (kind of my personal counter), and when
       inserting a new value, i should first take that number and
       increase it by one.- hehe, actually i don't need
       auto_increment at all then.

       ok, thanks.

       and when you're mentioning 3.23, when it will be available
       (in a week, month...).

       Davor
-- 

Thread
auto_increment after deleting last IDDavor Cengija22 May
  • Re: auto_increment after deleting last IDPaul DuBois22 May
    • Re: auto_increment after deleting last IDDavor Cengija22 May