title: Prevent auto increment on MySQL duplicate insert
body: <p>Using MySQL 5.1.49, I'm trying to implement a tagging system
  the problem I have is with a table with two columns: <code>id(autoincrement)</code>, <code>tag(unique varchar)</code> <em>(InnoDB)</em></p>
  
  <p>When using query, <code>INSERT IGNORE INTO tablename SET tag="whatever"</code>, the auto increment <code>id</code> value increases even if the insert was ignored.</p>
  
  <p>Normally this wouldn't be a problem, but I expect a lot of possible attempts to insert duplicates for this particular table which means that my next value for <code>id</code> field of a new row will be jumping way too much.</p>
  
  <p>For example I'll end up with a table with say 3 rows but bad <code>id</code>'s</p>
  
  <pre><code>1   | test
  8   | testtext
  678 | testtextt
  </code></pre>
  
  <p>Also, if I don't do <code>INSERT IGNORE</code> and just do regular <code>INSERT INTO</code> and handle the error, the auto increment field still increases so the next true insert is still a wrong auto increment.</p>
  
  <p>Is there a way to stop auto increment if there's an <code>INSERT</code> duplicate row attempt?</p>
  
  <p>As I understand for MySQL 4.1, this value wouldn't increment, but last thing I want to do is end up either doing a lot of <code>SELECT</code> statements in advance to check if the tags exist, or worse yet, downgrade my MySQL version.</p>