title: MySQL - adding constraint once adds it twice with diffent case
body: <p>I have this weird behaviour when I add a constraint to a MySQL table:</p>
  
  <pre><code>[...] add constraint qrtz_blob_triggers_ibfk_1 foreign key [...]
  </code></pre>
  
  <p>Now SHOW CREATE TABLE shows the constraint twice:</p>
  
  <pre><code>CONSTRAINT `qrtz_blob_triggers_ibfk_1` FOREIGN KEY [...]
  CONSTRAINT `QRTZ_BLOB_TRIGGERS_ibfk_1` FOREIGN KEY [...]
  </code></pre>
  
  <p>Here is the complete session:</p>
  
  <pre>
  mysql> DROP DATABASE IF EXISTS my_test; CREATE DATABASE my_test default character set utf8 collate utf8_bin;
  Query OK, 2 rows affected (0.07 sec)
  
  Query OK, 1 row affected (0.00 sec)
  
  mysql> use my_test;
  Database changed
  mysql> 
  mysql> DROP TABLE IF EXISTS `QRTZ_TRIGGERS`;
  Query OK, 0 rows affected, 1 warning (0.00 sec)
  
  mysql> 
  mysql> CREATE TABLE `QRTZ_TRIGGERS` (
         `TRIGGER_NAME` varchar(80) NOT NULL,
         `TRIGGER_GROUP` varchar(80) NOT NULL,
         PRIMARY KEY (`TRIGGER_NAME`,`TRIGGER_GROUP`)
       ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  Query OK, 0 rows affected (0.08 sec)
  
  mysql> 
  mysql> DROP TABLE IF EXISTS `QRTZ_BLOB_TRIGGERS`;
  Query OK, 0 rows affected, 1 warning (0.00 sec)
  
  mysql> 
  mysql> create table `QRTZ_BLOB_TRIGGERS` (`TRIGGER_NAME` varchar(80) not null, `TRIGGER_GROUP` varchar(80) not null, `BLOB_DATA` longblob, primary key (`TRIGGER_NAME`, `TRIGGER_GROUP`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  Query OK, 0 rows affected (0.08 sec)
  
  mysql> 
  mysql> alter table `QRTZ_BLOB_TRIGGERS`  add index qrtz_blob_triggers_ibfk_1 (`TRIGGER_NAME`, `TRIGGER_GROUP`), add constraint qrtz_blob_triggers_ibfk_1 foreign key (`TRIGGER_NAME`, `TRIGGER_GROUP`) references `QRTZ_TRIGGERS` (`TRIGGER_NAME`, `TRIGGER_GROUP`) ON UPDATE RESTRICT ON DELETE RESTRICT;
  Query OK, 0 rows affected (0.18 sec)
  Records: 0  Duplicates: 0  Warnings: 0
  
  mysql> 
  mysql> show create table QRTZ_BLOB_TRIGGERS \G
  *************************** 1. row ***************************
         Table: QRTZ_BLOB_TRIGGERS
  Create Table: CREATE TABLE `QRTZ_BLOB_TRIGGERS` (
    `TRIGGER_NAME` varchar(80) NOT NULL,
    `TRIGGER_GROUP` varchar(80) NOT NULL,
    `BLOB_DATA` longblob,
    PRIMARY KEY (`TRIGGER_NAME`,`TRIGGER_GROUP`),
    KEY `qrtz_blob_triggers_ibfk_1` (`TRIGGER_NAME`,`TRIGGER_GROUP`),
    CONSTRAINT `qrtz_blob_triggers_ibfk_1` FOREIGN KEY (`TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `QRTZ_TRIGGERS` (`TRIGGER_NAME`, `TRIGGER_GROUP`),
    CONSTRAINT `QRTZ_BLOB_TRIGGERS_ibfk_1` FOREIGN KEY (`TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `QRTZ_TRIGGERS` (`TRIGGER_NAME`, `TRIGGER_GROUP`)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8
  1 row in set (0.00 sec)
  </pre>
  
  <p>Using</p>
  
  <pre><code>[...] add constraint QRTZ_BLOB_TRIGGERS_ibfk_1 foreign key [...]
  </code></pre>
  
  <p>works fine.</p>
  
  <p>I am using Ubuntu 12.04 LTS with MySQL 5.5:</p>
  
  <pre><code>mysql-server-5.5     5.5.32-0ubuntu0.12.04.1
  </code></pre>
  
  <p>Does anyone have a clue what's going on there?</p>