title: MySQL unique behavior on NULL columns
body: <p>I have this table</p>
  
  <pre><code>CREATE TABLE IF NOT EXISTS `profile_connections` (
    `id` int(11) NOT NULL auto_increment,
    `profile_id` int(11) NOT NULL,
    `connection_profile_id` int(11) NOT NULL,
    `created` timestamp NOT NULL default CURRENT_TIMESTAMP,
    `deleted` timestamp NULL default NULL,
    PRIMARY KEY  (`id`),
    UNIQUE KEY `profile_id_2` (`profile_id`,`connection_profile_id`,`deleted`),
    KEY `profile_id` (`profile_id`,`connection_profile_id`)
  ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;
  </code></pre>
  
  <p>I have a UNIQUE on my columns (profile_id, connection_profile_id, deleted)</p>
  
  <p>Now the would like to be able to use 
  INSERT IGNORE INTO profile_connections SET profile_id = 2, connection_profile_id = 3</p>
  
  <p>And i want the database to "ignore" the insert if a row exists already with the values profile_id = 2, connection_profile_id = 3 and deleted = null</p>
  
  <p>But the table dont see the "deleted = null" as being the same values, so multiple rows can exists with the null value. </p>
  
  <p>Like</p>
  
  <pre><code>id | profile_id | connection_profile_id | created             | deleted
  2  | 4          | 3                 | 2010-12-16 10:34:46 | NULL
  3  | 4          | 3                 | 2010-12-16 10:34:53 | NULL
  </code></pre>
  
  <p>Is there anyhow to make the table work as i would like. 
  Or is the only way to create a SELECT query first to see if a row already exists??</p>