title: Why are 2 rows affected in my `INSERT ... ON DUPLICATE KEY UPDATE`?
body: <p>I'm doing an <code>INSERT ... ON DUPLICATE KEY UPDATE</code> for a <code>PRIMARY KEY</code> in the following table:</p>
  
  <pre><code>DESCRIBE users_interests;
  </code></pre>
  
  <pre class="lang-none prettyprint-override"><code>+------------+---------------------------------+------+-----+---------+-------+
  | Field      | Type                            | Null | Key | Default | Extra |
  +------------+---------------------------------+------+-----+---------+-------+
  | uid        | int(11)                         | NO   | PRI | NULL    |       |
  | iid        | int(11)                         | NO   | PRI | NULL    |       |
  | preference | enum('like','dislike','ignore') | YES  |     | NULL    |       |
  +------------+---------------------------------+------+-----+---------+-------+
  </code></pre>
  
  <p>However, even though these values should be unique, I'm seeing 2 rows affected.</p>
  
  <pre><code>INSERT INTO users_interests (uid, iid, preference) VALUES (2, 2, 'like')
  ON DUPLICATE KEY UPDATE preference='like';
  </code></pre>
  
  <pre class="lang-none prettyprint-override"><code>Query OK, 2 rows affected (0.04 sec)
  </code></pre>
  
  <p>Why is this happening?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>For comparison, see this query:</p>
  
  <pre><code>UPDATE users_interests SET preference='like' WHERE uid=2 AND iid=2;
  </code></pre>
  
  <pre class="lang-none prettyprint-override"><code>Query OK, 1 row affected (0.44 sec)
  Rows matched: 1  Changed: 1  Warnings: 0
  </code></pre>