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

JSON_ARRAY_INTERSECT returns NULL when "Deutsch" is part of the array

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 11.7.2
    • 11.8
    • JSON
    • None
    • Docker on MacOS
    • Unexpected results

    Description

      Possibly related: MDEV-34173

      The behavior from the title of this issue I can only observe in PhpMyAdmin, see screenshots, which is really weird.

      However in the cli, I observe the buggy behavior independet of the actual strings in the array.
      Expectation would be to have ["English"] in every row of the result, right?

      MariaDB [db]> SELECT id, JSON_ARRAY_INTERSECT('["German", "English"]', '["English"]') FROM events;
      +-----+--------------------------------------------------------------+
      | id  | JSON_ARRAY_INTERSECT('["German", "English"]', '["English"]') |
      +-----+--------------------------------------------------------------+
      |  20 | ["English"]                                                  |
      |  72 | NULL                                                         |
      | 136 | NULL                                                         |
      | 137 | NULL                                                         |
      | 138 | NULL                                                         |
      +-----+--------------------------------------------------------------+
      5 rows in set (0.001 sec)
      

      Also happens when using JSON_ARRAY instead of literal strings:

      MariaDB [db]> SELECT id, JSON_ARRAY_INTERSECT(JSON_ARRAY('English', 'Deutsch'), JSON_ARRAY('Deutsch')) FROM events;
      +-----+-------------------------------------------------------------------------------+
      | id  | JSON_ARRAY_INTERSECT(JSON_ARRAY('English', 'Deutsch'), JSON_ARRAY('Deutsch')) |
      +-----+-------------------------------------------------------------------------------+
      |  20 | ["Deutsch"]                                                                   |
      |  72 | NULL                                                                          |
      | 136 | NULL                                                                          |
      | 137 | NULL                                                                          |
      | 138 | NULL                                                                          |
      +-----+-------------------------------------------------------------------------------+
      5 rows in set (0.001 sec)
      

      Attachments

        1. expected.png
          expected.png
          19 kB
        2. buggy.png
          buggy.png
          18 kB

        Issue Links

          Activity

            People

              rucha174 Rucha Deodhar
              henk23 Heiko
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.