title: Db2 IN predicate yields NULL when comparing constant with empty set
body: <p>Consider this query:</p>
  
  <pre class="lang-sql prettyprint-override"><code>SELECT 
    1 IN (
      SELECT 1 FROM SYSIBM.dual WHERE FALSE  
    ) AS a,
    1 IN (
      SELECT NULL FROM SYSIBM.dual WHERE FALSE
    ) AS b
  FROM SYSIBM.dual;
  </code></pre>
  
  <p>Both predicates check if a constant value is in an empty set. The only difference is that one of the empty sets has a <code>NULL</code> literal in it, which, in my opinion is irrelevant. Both results should be <code>FALSE</code>, because no value is ever in an empty set. However, I'm getting this:</p>
  
  <pre><code>A|B|
  -|-|
  0| |
  </code></pre>
  
  <p><code>A</code> is <code>FALSE</code>, as expected, but <code>B IS NULL</code>, which makes no sense. Using <code>CAST(NULL AS INT)</code> doesn't change anything, in case this could have been because of unknown data types. Is there a logical explanation for this behaviour or is this a bug? Both MySQL and PostgreSQL return <code>FALSE</code> for <code>B</code>.</p>
  
  <pre class="lang-sql prettyprint-override"><code>-- PostgreSQL:
  SELECT 
    1 IN (
      SELECT 1 WHERE FALSE  
    ) AS a,
    1 IN (
      SELECT CAST(NULL AS INT) WHERE FALSE
    ) AS b
  
  -- MySQL:
  SELECT 
    1 IN (
      SELECT 1 WHERE FALSE  
    ) AS a,
    1 IN (
      SELECT NULL WHERE FALSE
    ) AS b
  </code></pre>
  
  <p>A simpler example exposes a similar bug (possibly related to a flawed implementation of Db2's <code>BOOLEAN</code> type <em>in general</em>):</p>
  
  <pre class="lang-sql prettyprint-override"><code>SELECT NULL OR FALSE AS a, FALSE OR NULL AS b FROM SYSIBM.dual; 
  </code></pre>
  
  <p>Which produces:</p>
  
  <pre><code>A|B|
  -|-|
  0| |
  </code></pre>
  
  <p>Clearly another bug. The order of operands in <code>OR</code> shouldn't matter.</p>
  
  <p>I'm using Db2 LUW v11.5.0.0</p>