title: Postgres: define a default value for CAST failures?
body: <p>Is it possible to define a default value that will be returned in case a <code>CAST</code> operation fails?</p>
  
  <p>For example, so that:</p>
  
  <pre><code>SELECT CAST('foo' AS INTEGER)
  </code></pre>
  
  <p>Will return a default value instead of throwing an error?</p>