title: Using 'case when' and null time stamp in select statement
body: <p>I'm using a <code>case when</code> block in postgresql to determine how results will be displayed.  The block is as follows:</p>
  
  <pre><code>(case 
      when four.status = 'active' and (four.expiration &gt; (current_date + integer '{{expire_window}}')) then 'Active'
      when four.status = 'active' and (four.expiration is null) then 'Active'
      when four.status = 'pending' then 'Pending'
      when four.status = 'active' and (four.expiration &lt;= (current_date + integer '{{expire_window}}')) then 'Expiring'
  
          else 'Missing' end) as certificate
  </code></pre>
  
  <p>The value <code>expiration</code> is a time stamp with time zone datatype that is null when there's nothing in it.  When expiration is null, I want four.status to show as active.  I've added that line <code>when four.status = 'active' and (four.expiration is null) then 'Active'</code>, but for some reason the results still show up as Missing.  If I only use <code>when four.expiration is null then 'Active'</code>, any results with a null expiration DO show as Active. </p>
  
  <p>How can I check both <code>four.status = 'Active'</code> and <code>four.expiration is null</code> in the same <code>when</code> line to get the proper results?</p>