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

JSON_REMOVE returns NULL on valid arguments.

    XMLWordPrintable

Details

    Description

      MariaDB [(none)]> SELECT JSON_REMOVE('{"A": { "B": 1 }}', '$.A.B.C');
      +---------------------------------------------+
      | JSON_REMOVE('{"A": { "B": 1 }}', '$.A.B.C') |
      +---------------------------------------------+
      | {"A": {"B": 1}}                             |
      +---------------------------------------------+
      1 row in set (0.00 sec)
      

      which is correct.

      MariaDB [(none)]> SELECT JSON_REMOVE('{"A": { "B": 1 }}', '$.A.B.C.D');
      +-----------------------------------------------+
      | JSON_REMOVE('{"A": { "B": 1 }}', '$.A.B.C.D') |
      +-----------------------------------------------+
      | NULL                                          |
      +-----------------------------------------------+
      1 row in set, 1 warning (0.00 sec)
       
      MariaDB [(none)]> show warnings;
      +---------+------+---------------------------------------------------------------------+
      | Level   | Code | Message                                                             |
      +---------+------+---------------------------------------------------------------------+
      | Warning | 4037 | Unexpected end of JSON text in argument 1 to function 'json_remove' |
      +---------+------+---------------------------------------------------------------------+
      1 row in set (0.00 sec)
      

      The result should be as in the first query, but we get NULL instead.

      user complained there on KB
      https://mariadb.com/kb/en/json_remove/#comment_4357

      Attachments

        Issue Links

          Activity

            People

              rucha174 Rucha Deodhar
              holyfoot Alexey Botchkov
              Votes:
              2 Vote for this issue
              Watchers:
              9 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.