title: When using "AND" in where clause get error "argument must be type boolean"
body: <p>Error:  argument of AND must be type boolean, not type character varying</p>
  
  <pre><code>SELECT 
      partno, 
      count(manufacturer) 
  FROM 
      components 
  WHERE 
      partno IN (SELECT partno FROM productions 
                 WHERE 
                      year = 2005
                  AND attr is NULL
                ) 
  GROUP BY partno
  UNION
  SELECT 
      partno, 
      count(manufacturer) 
  FROM components 
  WHERE 
      partno IN (SELECT partno FROM productions 
                 WHERE 
                     year = 2005
                 AND attr is NULL
                ) 
  GROUP BY partno
  ) 
  AND (
          partno NOT IN (SELECT partno FROM components
      )
  ); 
  </code></pre>
  
  <p>The part after the union is to include all partno from components that are not in productions (they should be counted as 0)</p>