title: Cannot delete or update a parent row: a foreign key constraint fails while updating parent
body: <p>I have a table like that: </p>
  
  <pre><code>CREATE TABLE `testt` (
    `id` int(11) NOT NULL,
    `pid` int(11) DEFAULT NULL,
    `active` int(11) NOT NULL DEFAULT '0',
    `pacitve` int(11) NOT NULL DEFAULT '0',
    PRIMARY KEY (`id`),
    KEY `id` (`id`,`active`),
    KEY `pid` (`pid`,`pacitve`),
    CONSTRAINT `active_fk` FOREIGN KEY (`pid`, `pacitve`) REFERENCES `testt` (`id`, `active`) ON DELETE CASCADE ON UPDATE CASCADE
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1
  </code></pre>
  
  <p>pid stands for parent id</p>
  
  <p>My data is like that:</p>
  
  <pre><code>id     pid    active  pactive
  
  1      NULL    0       0
  
  2      1       0       0
  
  3      1       0       0
  
  4      2       0       0
  </code></pre>
  
  <p>When I set active = 1 for id = 1, I get this exception. Why am I getting this error? Delete works fine. My purpose is that when I set active=1 for id=1, all children of id=1 should be updated.</p>