title: PSQL - invalid input syntax for type double precision: "null";
body: <p>I'm writing a query to pull some data and running into this invalid input syntax for type double precision: "null" error and am not entirely sure the meaning behind it and/or haven't figured out a solution.  The column I'm running the case statment on does have null values in it or it has the appropriate value that i need.</p>
  
  <p>account id col could have strings or it has null values</p>
  
  <p>I've tried:</p>
  
  <pre><code>case
      when length(account_id) &gt; 1
        then account_id
      else
        'null'
      end as account_id,
  </code></pre>
  
  <p>and </p>
  
  <pre><code>case
      when account_id is not null
        then account_id
      else
        'null'
      end as account_id,
  </code></pre>
  
  <p>both resulting in Invalid operation: invalid input syntax for type double precision: "null";</p>
  
  <p>When i just put this in a column and use the length(account_id) it will show the length or just display null - why wouldn't this work in a case statement?</p>
  
  <p>Thanks!</p>