Eiolon Posted June 25, 2008 Share Posted June 25, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/111909-problem-with-record-ids-being-re-used/ Share on other sites More sharing options...
bluejay002 Posted June 26, 2008 Share Posted June 26, 2008 that's not possible (i guess), unless someone has changed the next value for auto increment (since its possible to change). Quote Link to comment https://forums.phpfreaks.com/topic/111909-problem-with-record-ids-being-re-used/#findComment-574715 Share on other sites More sharing options...
fenway Posted June 26, 2008 Share Posted June 26, 2008 That is very strange... which table type? Quote Link to comment https://forums.phpfreaks.com/topic/111909-problem-with-record-ids-being-re-used/#findComment-574744 Share on other sites More sharing options...
PFMaBiSmAd Posted June 26, 2008 Share Posted June 26, 2008 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? Quote Link to comment https://forums.phpfreaks.com/topic/111909-problem-with-record-ids-being-re-used/#findComment-574754 Share on other sites More sharing options...
Eiolon Posted June 26, 2008 Author Share Posted June 26, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/111909-problem-with-record-ids-being-re-used/#findComment-575047 Share on other sites More sharing options...
fenway Posted June 26, 2008 Share Posted June 26, 2008 Did you recently restore from a backup? Quote Link to comment https://forums.phpfreaks.com/topic/111909-problem-with-record-ids-being-re-used/#findComment-575064 Share on other sites More sharing options...
bluejay002 Posted June 27, 2008 Share Posted June 27, 2008 Weird? I don't really see anything wrong with it... well I guess, even from defining the table won't do anything weird at all... except if someone truncated the table or reset the auto-increment. Quote Link to comment https://forums.phpfreaks.com/topic/111909-problem-with-record-ids-being-re-used/#findComment-575700 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.