Absolutely nothing prevents you from assigning an arbitrary value to the AUTO_INCREMENT column. If necessary, the table counter will be adjusted accordingly.
However, you cannot set a column that is not unique as AUTO_INCREMENT .
Honestly, I do not understand your design. A typical messaging system would look like this:
message_id in_reply_to ========== =========== 1 NULL 2 NULL 3 1 4 NULL 5 1 6 3 7 NULL
Duplication of identifiers leads to the use of identifiers.
Update # 1: OMG, it seems like this can actually be done under certain circumstances:
For MyISAM tables, you can specify AUTO_INCREMENT on the secondary column in a multi-column index. In this case, the generated value for the AUTO_INCREMENT column is calculated as MAX (auto_increment_column) + 1 WHERE prefix = prefix specified. This is useful when you want to put data in ordered groups.
http://dev.mysql.com/doc/refman/5.5/en/example-auto-increment.html
Update # 2:. For the records, I just tested it, and you can also use duplicate auto-increment identifiers in InnoDB tables:
CREATE TABLE foo ( foo_id INT(10) NOT NULL DEFAULT '0', bar_id INT(10) NOT NULL AUTO_INCREMENT, PRIMARY KEY (foo_id), INDEX bar_id (bar_id) ) ENGINE=InnoDB
source share