<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="alter-table-problems">
      </a>
      B.3.6.1 Problems with ALTER TABLE
     </h4>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045053376064">
  </a>
  <a class="indexterm" name="idm46045053375024">
  </a>
  <a class="indexterm" name="idm46045053373536">
  </a>
  <a class="indexterm" name="idm46045053372048">
  </a>
  <p>
   If you get a duplicate-key error when using
   <a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
    <code class="literal">
     ALTER TABLE
    </code>
   </a>
   to change the
          character set or collation of a character column, the cause is
          either that the new column collation maps two keys to the same
          value or that the table is corrupted. In the latter case, you
          should run
   <a class="link" href="repair-table.html" title="15.7.3.5 REPAIR TABLE Statement">
    <code class="literal">
     REPAIR TABLE
    </code>
   </a>
   on the
          table.
   <a class="link" href="repair-table.html" title="15.7.3.5 REPAIR TABLE Statement">
    <code class="literal">
     REPAIR TABLE
    </code>
   </a>
   works for
   <code class="literal">
    MyISAM
   </code>
   ,
   <code class="literal">
    ARCHIVE
   </code>
   , and
   <code class="literal">
    CSV
   </code>
   tables.
  </p>
  <p>
   If you use
   <a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
    <code class="literal">
     ALTER TABLE
    </code>
   </a>
   on a
          transactional table or if you are using Windows,
   <a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
    <code class="literal">
     ALTER TABLE
    </code>
   </a>
   unlocks the table
          if you had done a
   <a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
    <code class="literal">
     LOCK
          TABLE
    </code>
   </a>
   on it. This is done because
   <code class="literal">
    InnoDB
   </code>
   and these operating systems cannot
          drop a table that is in use.
  </p>
 </div>
 <br/>
</div>
