title: SQLSTATE 58004, Error "invalid qnc assigment" when using NULL in JSON_OBJECT() with LISTAGG in DB2 LUW
body: <p>There seems to be an interesting combination of features that lead to an error in Db2 LUW v11.5.0.0. To reproduce, write:</p>
  
  <pre class="lang-sql prettyprint-override"><code>CREATE TABLE t (a INT);
  INSERT INTO t VALUES (1), (2);
  
  SELECT '[' || listagg(
    json_object(
      KEY 'a' VALUE a,
      KEY 'b' VALUE b
    ), ','
  ) WITHIN GROUP (ORDER BY a) || ']'
  FROM (
    SELECT a, NULL b
    FROM t
    ORDER BY a
  );
  </code></pre>
  
  <p>I'm using <code>LISTAGG</code> to work around Db2 LUW's missing <code>JSON_ARRAYAGG</code> support.</p>
  
  <p>The error I'm getting is this:</p>
  
  <blockquote>
    <p>The SQL statement or command failed because of a database system error. (Reason "invalid qnc assigment".). SQLCODE=-901, SQLSTATE=58004, DRIVER=4.7.85</p>
  </blockquote>
  
  <p>Quite probably a bug in the parser. There doesn't seem to be anything obviously wrong. How can this be prevented / worked around?</p>