title: How do I avoid a numeric data overflow
body: <p>I have a query that ran fine in our old MySQL database where there is a check:</p>
  
  <pre><code>WHERE column_x + column_y &gt; 524288000
  </code></pre>
  
  <p>Now that we've migrated to Redshift, the query fails:</p>
  
  <pre><code>ERROR: Numeric data overflow (addition)
    Detail: 
    -----------------------------------------------
    error:  Numeric data overflow (addition)
    code:      1058
    context:   
    query:     915381
    location:  numeric.hpp:112
    process:   query4_s0_22 [pid=6421]
    ----------------------------------------------- [SQL State=XX000] 
  </code></pre>
  
  <p>Both columns are of type <code>bigint</code>. When running the query without adding the columns (just checking against one column or the other) the query executes fine. I'm assuming there are rows where <code>column_x + column_y</code> is greater than the max size of <code>bigint</code>.</p>
  
  <p>What's the workaround here?</p>