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

JSON_REMOVE returns wrong result and ER_JSON_EOS after not finding element to remove

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.2(EOL), 10.3(EOL), 10.4(EOL), 10.5
    • 10.5
    • JSON
    • None

    Description

      10.5 1b12e251

      MariaDB [test]> SELECT JSON_REMOVE('{"a":"b"}','$[0][1].a');
      +--------------------------------------+
      | JSON_REMOVE('{"a":"b"}','$[0][1].a') |
      +--------------------------------------+
      | NULL                                 |
      +--------------------------------------+
      1 row in set, 1 warning (0.000 sec)
       
      MariaDB [test]> SHOW WARNINGS;
      +---------+------+---------------------------------------------------------------------+
      | Level   | Code | Message                                                             |
      +---------+------+---------------------------------------------------------------------+
      | Warning | 4037 | Unexpected end of JSON text in argument 1 to function 'json_remove' |
      +---------+------+---------------------------------------------------------------------+
      1 row in set (0.000 sec)
      

      MySQL returns the untouched JSON document instead:

      MySQL [test]> SELECT JSON_REMOVE('{"a":"b"}','$[0][1].a');
      +--------------------------------------+
      | JSON_REMOVE('{"a":"b"}','$[0][1].a') |
      +--------------------------------------+
      | {"a": "b"}                           |
      +--------------------------------------+
      1 row in set (0.000 sec)
      

      Attachments

        Issue Links

          Activity

            People

              rucha174 Rucha Deodhar
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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