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
https://forums.phpfreaks.com/topic/111909-problem-with-record-ids-being-re-used/
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?

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.