title: Redshift/Postgres: how can I ignore rows that generate errors? (Invalid JSON in json_extract_path_text)
body: <p>I'm trying to run a query in redshift where I'm selecting using <code>json_extract_path_text</code>.  Unfortunately, some of the JSON entries in this database column are invalid.  </p>
  
  <p><em>What happens:</em>
  When the query hits an invalid JSON value, it stops with a "JSON parsing error".</p>
  
  <p><em>What I want:</em> Ignore any rows with invalid JSON in that column, but return any rows where it can parse the JSON.</p>
  
  <p><em>Why I can't make it do what I want:</em> I don't think I understand error handling in Redshift/Postgres.  It should be possible to simply skip any rows that generate errors, but I tried entering <code>EXEC SQL WHENEVER SQLERROR CONTINUE</code> (based on <a href="http://www.postgresql.org/docs/8.0/static/ecpg-errors.html" rel="noreferrer">the Postgres docs</a>) and got a "syntax error at or near <code>SQLERROR</code>".</p>