title: How to truncate a foreign key constrained table?
body: <p>Why doesn't a <strong>TRUNCATE</strong> on <code>mygroup</code> work?
  Even though I have <code>ON DELETE CASCADE SET</code> I get:</p>
  
  <blockquote>
    <p>ERROR 1701 (42000): Cannot truncate a table referenced in a foreign key constraint (<code>mytest</code>.<code>instance</code>, CONSTRAINT <code>instance_ibfk_1</code> FOREIGN KEY (<code>GroupID</code>) REFERENCES <code>mytest</code>.<code>mygroup</code> (<code>ID</code>))</p>
  </blockquote>
  
  <pre><code>drop database mytest;
  create database mytest;
  use mytest;
  
  CREATE TABLE mygroup (
     ID    INT NOT NULL AUTO_INCREMENT PRIMARY KEY
  ) ENGINE=InnoDB;
  
  CREATE TABLE instance (
     ID           INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
     GroupID      INT NOT NULL,
     DateTime     DATETIME DEFAULT NULL,
  
     FOREIGN KEY  (GroupID) REFERENCES mygroup(ID) ON DELETE CASCADE,
     UNIQUE(GroupID)
  ) ENGINE=InnoDB;
  </code></pre>