I somehow tricked MySQL into believing I have a foreign key that does not exist.
I had a table with both an
Id column and a
Number column. I wanted to merge the two, so I cleared the few tables referring to it, then cleared and remade the foreign keys so that they pointed to
Id instead of
Number. But when I went to delete the
Number column I was told my foreign key constraint was incorrectly formed. I double checked I had removed all foreign keys associated with that column and tried again to no avail.
I then tried renaming the table. It worked fine. After renaming it, I deleted the
Number column. It worked fine. Then I tried naming the table back and was given the same message.
After that I converted the table to MYISAM, then renaming it. That also worked. Lastly, I tried converting the table back to InnoDB, which gives me the same error.
Where did this 'ghost' key come from and how do I get rid of it without dumping the entire database?