title: InnoDB: Changing the length of a VARCHAR primary Key
body: <p>I have a table in InnoDB which uses a VARCHAR based ForeignKey:</p>
  
  <pre><code>CREATE TABLE `portal_equity` (
     `isin` varchar(12) NOT NULL,
      ....,
      PRIMARY KEY (`isin`),
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 
  </code></pre>
  
  <p>Another table has a ForeignKey constraint to that table:</p>
  
  <pre><code>CONSTRAINT `equity_id_refs_isin_2581bb1d` FOREIGN KEY (`equity_id`) REFERENCES `portal_equity` (`isin`)
  </code></pre>
  
  <p>I needed to change the length of the primary key VARCHAR column, so I did. Now I keep getting the following integrity error every time I want to reference a row from the "portal_equity" table where the isin exceeds the original length of 12.</p>
  
  <blockquote>
    <p>Foreign key constraint fails for table <code>investtor</code>.<code>portal_equitypastvalue</code>:
       CONSTRAINT <code>equity_id_refs_isin_7eed44e7</code> FOREIGN KEY (<code>equity_id</code>) REFERENCES <code>portal_equity</code> (<code>isin</code>)
       Trying to add in child table, in index <code>portal_equitypastvalue_equity_id_6e7526e1</code> tuple:
       DATA TUPLE: 3 fields;
       0: len 12; hex 304c55303332333133343030; asc 0LU032313400;; 1: len 3; hex 8fb578; asc   x;; 2: len 4; hex 8001398a; asc   9 ;;</p>
    
    <p>But in parent table <code>investtor</code>.<code>portal_equity</code>, in index <code>PRIMARY</code>, the closest match we can find is record:
       PHYSICAL RECORD: n_fields 9; compact format; info bits 0
       0: len 13; hex 304c5530333233313334303036; asc 0LU0323134006;; 1: len 6; hex 000000005139; asc     Q9;; 2: len 7; hex 800000002d0110; asc     -  ;; 3: len 4; hex 61736466; asc asdf;; 4: len 4; hex 80000050; asc    P;; 5: len 3; hex 736466; asc sdf;; 6: len 4; hex 80000001; asc     ;; 7: len 2; hex 4144; asc AD;; 8: len 0; hex ; asc ;;</p>
  </blockquote>
  
  <p>Do I need to regenerate all foreignkey constraints? That seems rather excessive. Is this behavior/error documented somewhere?</p>