title: ERROR: CASE types character varying and numeric cannot be matched
body: <p>I am writing a select statement in Postgres which contains case statement as follows:</p>
  
  <pre><code>,(case when all_loc.country = 'DE' then msc_si.buyer_id else msc_si.buyer_name end) as "purchasing_group_name_buyer_name"  --story
  ,(case when all_loc.country = 'DE' then msc_si.planner_code else mscp.description end) as "mrp_controller_name"                --story
  </code></pre>
  
  <p>I am getting the following error. I tried with <code>IS</code> instead of <code>=</code>, didn't work. Without those two <code>case</code> statements the query runs perfectly. </p>
  
  <blockquote>
    <p>ERROR: CASE types character varying and numeric cannot be matched SQL
    state: 42804</p>
  </blockquote>