My drupal worked with database in monopoly mode, and so I did not adding prefixes to table names. With adding another software to this database tables of drupal were renamed with adding of prefixes "dr_". And drupal begin new counters in table "sequnces": comments_cid = 2279 and dr_comments_cid = 1 and so on. And now comments start numering from 1. And new comment is lossing without any report if we have oldest comment with the same number,
As for me table's name in table "sequnces" must be store in initial variant. Some piece of code from database.mysql.inc:

function db_next_id($name) {
$name = db_prefix_tables($name);
db_query('LOCK TABLES {sequences} WRITE');
$id = db_result(db_query("SELECT id FROM {sequences} WHERE name = '%s'", $name)) + 1;
db_query("REPLACE INTO {sequences} VALUES ('%s', %d)", $name, $id);
db_query('UNLOCK TABLES');

return $id;
}

Here variable {sequences} egual to full real name of table.

Comments

drumm’s picture

Status: Needs review » Closed (works as designed)

If you change your table names, you must do the same changes to the {sequences} table. This is not necessary in Drupal 6 because we use auto_increment and the equivalent in other database engines.