title: How does one remove foreign-keys if the table they're on doesn't exist?
body: <p>Scenario:</p>
  
  <pre><code>DELETE FROM table_x WHERE id not in (1,2,3,4)
  </code></pre>
  
  <p>Response:  </p>
  
  <blockquote>
    <p>update or delete on table "table_x" violates foreign key constraint
    "fk1" on table "table_y" DETAIL:  Key (table_x_id)=(7) is still
    referenced from table "table_y".</p>
  </blockquote>
  
  <ul>
  <li>emptied 'table_y' of all records</li>
  <li>FK didn't show in the FK list for 'table_y'</li>
  <li>deleted the table 'table_y' completely</li>
  </ul>
  
  <p>We still get this message, so the assumption is that there is a rouge record somewhere in the <code>pg_constraints</code> table. Looking for the constraint 'fk1' we find two records and remove them.</p>
  
  <p>Query:</p>
  
  <pre><code>delete from pg_constraint where conname = 'fk1'
  </code></pre>
  
  <p>Now we get THIS error:</p>
  
  <blockquote>
    <p>[Err] ERROR:  cache lookup failed for constraint 868152</p>
  </blockquote>
  
  <p>At this point I'm fairly certain that we need to clean up some records, but not sure how - anybody have experience in this that could point me in the right direction?</p>