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

JSON_EXTRACT produces incorrect result for double wildcard

    XMLWordPrintable

Details

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

    Description

      Consider this example:

       
      set @json=
      '{
        "range_scan_alternatives":  {
          "ranges": [ "(1) <= (kp1) <= (1)",
                      "(2) <= (kp1) <= (2)" ],
          "aaa":"bbb"
        }
      }';
      select json_valid(@json);
      select json_extract(@json, '$**.range_scan_alternatives**.ranges');
      

      On MariaDB, it produces:

      MariaDB [test]> select json_extract(@json, '$**.range_scan_alternatives**.ranges');
      +-------------------------------------------------------------+
      | json_extract(@json, '$**.range_scan_alternatives**.ranges') |
      +-------------------------------------------------------------+
      | NULL                                                        |
      +-------------------------------------------------------------+
      

      I think the correct result should be what MySQL-8 produces:

      mysql> select json_extract(@json, '$**.range_scan_alternatives**.ranges');
      +-------------------------------------------------------------+
      | json_extract(@json, '$**.range_scan_alternatives**.ranges') |
      +-------------------------------------------------------------+
      | [["(1) <= (kp1) <= (1)", "(2) <= (kp1) <= (2)"]]            |
      +-------------------------------------------------------------+
      

      Attachments

        Issue Links

          Activity

            People

              rucha174 Rucha Deodhar
              psergei Sergei Petrunia
              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.