Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.2.6
    • 10.2.9
    • JSON
    • None

    Description

      SELECT JSON_MERGE('[{"a":"b"}]', '{"c":"d"}');
      -- [{"a": "b"}, {"c": "d"}]
       
      SELECT JSON_MERGE('[]', '{"c":"d"}');
      -- MariaDb 10.2: NULL <-- bug
      -- MySql 5.7: [{"c": "d"}]
      

      Attachments

        Activity

          Mikmak Aleksey M created issue -
          Mikmak Aleksey M made changes -
          Field Original Value New Value
          Description SELECT JSON_MERGE('[{"a":"b"}]', '{"c":"d"}');
          _-- [{"a": "b"}, {"c": "d"}]_

          SELECT JSON_MERGE('[]', '{"c":"d"}');
          _-- MariaDb 10.2: NULL_ <-- bug
          _-- MySql 5.7: [{"c": "d"}]_
          SELECT JSON_MERGE('[{"a":"b"}]', '{"c":"d"}');
          -- [{"a": "b"}, {"c": "d"}]

          SELECT JSON_MERGE('[]', '{"c":"d"}');
          -- MariaDb 10.2: NULL <-- bug
          -- MySql 5.7: [{"c": "d"}]
          Mikmak Aleksey M made changes -
          Description SELECT JSON_MERGE('[{"a":"b"}]', '{"c":"d"}');
          -- [{"a": "b"}, {"c": "d"}]

          SELECT JSON_MERGE('[]', '{"c":"d"}');
          -- MariaDb 10.2: NULL <-- bug
          -- MySql 5.7: [{"c": "d"}]
          {code:sql}
          SELECT JSON_MERGE('[{"a":"b"}]', '{"c":"d"}');
          -- [{"a": "b"}, {"c": "d"}]

          SELECT JSON_MERGE('[]', '{"c":"d"}');
          -- MariaDb 10.2: NULL <-- bug
          -- MySql 5.7: [{"c": "d"}]
          {code}
          elenst Elena Stepanova made changes -
          Status Open [ 1 ] Confirmed [ 10101 ]
          elenst Elena Stepanova added a comment - - edited

          Thanks for the report.

          JSON_MERGE complains about the empty array:

          MariaDB [test]> SELECT JSON_MERGE('[]', '{"c":"d"}');
          +-------------------------------+
          | JSON_MERGE('[]', '{"c":"d"}') |
          +-------------------------------+
          | NULL                          |
          +-------------------------------+
          1 row in set, 1 warning (0.00 sec)
           
          MariaDB [test]> SHOW WARNINGS;
          +---------+------+--------------------------------------------------------------------------------+
          | Level   | Code | Message                                                                        |
          +---------+------+--------------------------------------------------------------------------------+
          | Warning | 4038 | Syntax error in JSON text in argument 1 to function 'json_merge' at position 2 |
          +---------+------+--------------------------------------------------------------------------------+
          1 row in set (0.00 sec)
          

          But JSON_VALID says it's okay:

          MariaDB [test]> SELECT JSON_VALID('[]');
          +------------------+
          | JSON_VALID('[]') |
          +------------------+
          |                1 |
          +------------------+
          1 row in set (0.00 sec)
          

          elenst Elena Stepanova added a comment - - edited Thanks for the report. JSON_MERGE complains about the empty array: MariaDB [test]> SELECT JSON_MERGE( '[]' , '{"c":"d"}' ); + -------------------------------+ | JSON_MERGE( '[]' , '{"c":"d"}' ) | + -------------------------------+ | NULL | + -------------------------------+ 1 row in set , 1 warning (0.00 sec)   MariaDB [test]> SHOW WARNINGS; + ---------+------+--------------------------------------------------------------------------------+ | Level | Code | Message | + ---------+------+--------------------------------------------------------------------------------+ | Warning | 4038 | Syntax error in JSON text in argument 1 to function 'json_merge' at position 2 | + ---------+------+--------------------------------------------------------------------------------+ 1 row in set (0.00 sec) But JSON_VALID says it's okay: MariaDB [test]> SELECT JSON_VALID( '[]' ); + ------------------+ | JSON_VALID( '[]' ) | + ------------------+ | 1 | + ------------------+ 1 row in set (0.00 sec)
          elenst Elena Stepanova made changes -
          Component/s JSON [ 13908 ]
          Component/s Data types [ 13906 ]
          Fix Version/s 10.2 [ 14601 ]
          Assignee Alexey Botchkov [ holyfoot ]
          StevenWdV Steven WdV added a comment - - edited

          Relates to / duplicate of MDEV-13324.
          EDIT: maybe actually the other way around.

          StevenWdV Steven WdV added a comment - - edited Relates to / duplicate of MDEV-13324 . EDIT: maybe actually the other way around.
          holyfoot Alexey Botchkov made changes -
          Status Confirmed [ 10101 ] In Progress [ 3 ]
          holyfoot Alexey Botchkov made changes -
          Fix Version/s 10.2.9 [ 22611 ]
          Fix Version/s 10.2 [ 14601 ]
          Resolution Fixed [ 1 ]
          Status In Progress [ 3 ] Closed [ 6 ]
          serg Sergei Golubchik made changes -
          Workflow MariaDB v3 [ 81263 ] MariaDB v4 [ 152339 ]

          People

            holyfoot Alexey Botchkov
            Mikmak Aleksey M
            Votes:
            0 Vote for this issue
            Watchers:
            4 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.