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, 10.3, 10.4, 10.5
    • 10.4, 10.5
    • 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

        Activity

          People

            rucha174 Rucha Deodhar
            psergei Sergei Petrunia
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.