title: copy csv postgres ignore rows that violate constraints
body: <p>I have a .csv file with ~300,000 rows, some of which violate certain constraints I set in my postgres database. Is there a way to copy my .csv file into the database and have postgres filter out the rows that violate the constraints? I do not want these rows to show up in the database.</p>
  
  <p>If this is not possible, is there any other way to solve this problem?</p>
  
  <p>what I'm doing right now is</p>
  
  <pre><code>COPY blocksequences from '/tmp/blocksequences.csv CSV HEADER;
  </code></pre>
  
  <p>And I get</p>
  
  <pre><code>'ERROR:  new row for relation "blocksequences" violates check constraint "blocksequences_partid3_check"
  DETAIL:  Failing row contains (M001-M049-S186, M001, null, M049, S186).
  CONTEXT:  COPY blocksequences, line 680: "M001-M049-S186,M001,,M049,S186"
  </code></pre>
  
  <p>reason for the error: column that contains M049 is not allowed to have that string entered. Many other rows have violations like this.</p>
  
  <p>I read a little about <code>exception when check violation --do nothing</code> am I on the right track here? seems like it's only a mysql thing maybe</p>