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

          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)
          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.

          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.