Jump to content

Problem with record id's being re-used


Eiolon

Recommended Posts

I have run into a small problem.  For some reason, record id's are starting to be re-used in one of my applications.  It's been working fine for several months.  All of a sudden it has started at #1.  I was under the assumption if a record id was deleted it would never be re-used (using auto_increment).

 

Has this happened to anyone before?  Is there anything that I can check for on the MySQL end to see if there is a problem?  It's only happening to one table.  Thanks.

Link to comment
Share on other sites

Posting your table definition would help.

 

About the only thing I can think would be if the value reached the maximum defined value and then wrapped around. This would require either using a TINYINT/SMALLINT, a very active database, or the auto_increment value was somehow set to be near the top of the possible values for the INT type.

 

What are some of the higher values present in the table before the lower numbers started showing up?

Link to comment
Share on other sites

Here is my table structure:

 

CREATE TABLE `programs` (
  `program_id` int(11) unsigned NOT NULL auto_increment,
  `program_name` varchar(100) NOT NULL,
  `program_date` datetime NOT NULL default '0000-00-00 00:00:00',
  `program_coordinator` varchar(100) default NULL,
  `program_description` text,
  `program_seats` tinyint(3) unsigned NOT NULL default '0',
  PRIMARY KEY  (`program_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ;

 

From my latest backup, the highest ID it got to was 43.  For some reason it's started at 1.  This is an internal use script for my work and no one here has access to the database.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.