Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-11433

JSON_MERGE returns a non-NULL result with a NULL argument

    XMLWordPrintable

    Details

      Description

      Note: Since we don't have any documented differences between our implementation of JSON functions and Oracle's, here and further I will assume they are supposed to be result-compatible.

      MariaDB 10.2

      MariaDB [test]> select JSON_MERGE(NULL,JSON_OBJECT('foo', 1));
      +----------------------------------------+
      | JSON_MERGE(NULL,JSON_OBJECT('foo', 1)) |
      +----------------------------------------+
      | [null, {"foo": 1}]                     |
      +----------------------------------------+
      1 row in set (0.00 sec)
      

      MySQL 5.7

      MySQL [test]> select JSON_MERGE(NULL,JSON_OBJECT('foo', 1));
      +----------------------------------------+
      | JSON_MERGE(NULL,JSON_OBJECT('foo', 1)) |
      +----------------------------------------+
      | NULL                                   |
      +----------------------------------------+
      1 row in set (0.00 sec)
      

      It is also documented in MySQL manual:
      https://dev.mysql.com/doc/refman/5.7/en/json-modification-functions.html#function_json-merge

      Returns NULL if any argument is NULL

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              holyfoot Alexey Botchkov
              Reporter:
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: