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

JSON_MERGE returns incorrect result

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.2(EOL)
    • 10.2.3
    • JSON
    • None

    Description

      MariaDB 10.2

      MariaDB [test]>  SELECT JSON_MERGE('[1, 2]', '{"id": 47}');
      +------------------------------------+
      | JSON_MERGE('[1, 2]', '{"id": 47}') |
      +------------------------------------+
      | [[1, 2], {"id": 47}]               |
      +------------------------------------+
      1 row in set (0.00 sec)
      

      MySQL 5.7

      MySQL [test]>  SELECT JSON_MERGE('[1, 2]', '{"id": 47}');
      +------------------------------------+
      | JSON_MERGE('[1, 2]', '{"id": 47}') |
      +------------------------------------+
      | [1, 2, {"id": 47}]                 |
      +------------------------------------+
      1 row in set (0.00 sec)
      

      An adjacent array and object are merged by autowrapping the object as an array and merging the two arrays.

      https://dev.mysql.com/doc/refman/5.7/en/json-modification-functions.html#function_json-append

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.