Posted by mike_gie12 on November 9, 2008 at 7:32am
Hi! Just want to share this to everyone. I don't know if this can be considered a lesson here but it sure was a lesson to me. Drupal has its own sequence for adding new entries (like menus, nodes, terms, vocabularies, and etc...). Some of its core module triggers 'db_next_id' to provide the next key before inserting a new record. In some cases, it is not really advisable to just do a backdoor insert as it might screw up the current sequence. Make sure to always check the 'sequences' table before doing some magic :P Just a warning! (It knocked me when I was trying to insert a menu after installing internationalization)
mike_gie.

Comments
As a rule of thumb, do not
As a rule of thumb, do not modify data directly on the database if it is core related. Always use the Drupal API.
Yea.. hehe! I got impatient
Yea.. hehe! I got impatient so I took it for granted :) bad experience...
Drupal 6 handles it differently
Note that the sequences table has been removed in Drupal 6 in favor of auto_increment IDs. Use db_last_insert_id() (I think that's what it's called) instead of db_next_id().
-=Aaron
Sometimes it's just a lot
Sometimes it's just a lot quicker running a mysql query, hehe. I've been in this situation a few times too.