title: Foreign key constrain ON DELETE CASCADE still throws constraint error
body: <p>for some of the records in the database, I could delete entries in table2 which were automatically deleted in table1. But for some cases, that didn't happen, even though they are identical (same tables, same foreign key reference, different values)</p>
  <p>I get following error:</p>
  <pre><code>SQL Error [23503]: ERROR: update or delete on table &quot;table2&quot; violates foreign key constraint &quot;table1_user_id_fk&quot; on table &quot;table1&quot;
    Detail: Key (id)=(1) is still referenced from table &quot;table1&quot;.
  </code></pre>
  <p>The code I used:</p>
  <p>First to remove constraint</p>
  <pre><code>alter table table1
  drop constraint table1;
  </code></pre>
  <p>Add <code>on delete cascade</code> constraint</p>
  <pre><code>alter table table1
  add constraint table1_user_id_fk
  foreign key (fk_id)
  references table2 (id)
  on delete cascade;
  </code></pre>
  <p>When I perform a deletion like this</p>
  <pre><code>delete from table2 where col1 = 'someval';
  </code></pre>
  <p>It throws the error stated above.</p>
  <p>Right now I can't wrap my head around it, because for different vals of col1, it does delete the record in table1 automatically, and for some it throws a constraint problem</p>