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

Problems in comparisons using JSON_EXTRACT

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Confirmed (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 10.5.17, 10.6.9, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9
    • Fix Version/s: 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9
    • Component/s: JSON
    • Labels:
      None
    • Environment:
      Ubuntu 22.04

      Description

      Unexpected behavior when comparing some results with the JSON_EXTRACT function.

      MariaDB

      MariaDB [(none)]> SELECT VERSION();
      +-----------------+
      | VERSION()       |
      +-----------------+
      | 10.6.9-MariaDB  |
      +-----------------+
      1 row in set (0.000 sec)
       
      MariaDB [(none)]> SELECT
          ->   JSON_VALID('"MariaDB"'),
          ->   JSON_TYPE('"MariaDB"'),
          ->   JSON_EXTRACT('"MariaDB"', '$'),
          ->   JSON_EXTRACT('"MariaDB"', '$') = JSON_EXTRACT('"MariaDB"', '$'), -- I would expect 1
          ->   JSON_EXTRACT('"MariaDB"', '$') <=> JSON_EXTRACT('"MariaDB"', '$'), -- I would expect 1
          ->   JSON_EXTRACT('"MariaDB"', '$') IN ('"MariaDB"'), -- I would expect 1
          ->   '"MariaDB"' IN (JSON_EXTRACT('"MariaDB"', '$')), -- I would expect 1
          ->   JSON_EXTRACT('"MariaDB"', '$') IN ('MariaDB'), -- I would expect 0
          ->   'MariaDB' IN (JSON_EXTRACT('"MariaDB"', '$'))\G -- I would expect 0
      *************************** 1. row ***************************
                                                JSON_VALID('"MariaDB"'): 1
                                                 JSON_TYPE('"MariaDB"'): STRING
                                         JSON_EXTRACT('"MariaDB"', '$'): "MariaDB"
        JSON_EXTRACT('"MariaDB"', '$') = JSON_EXTRACT('"MariaDB"', '$'): 0
      JSON_EXTRACT('"MariaDB"', '$') <=> JSON_EXTRACT('"MariaDB"', '$'): 0
                        JSON_EXTRACT('"MariaDB"', '$') IN ('"MariaDB"'): 0
                        '"MariaDB"' IN (JSON_EXTRACT('"MariaDB"', '$')): 0
                          JSON_EXTRACT('"MariaDB"', '$') IN ('MariaDB'): 1
                          'MariaDB' IN (JSON_EXTRACT('"MariaDB"', '$')): 1
      1 row in set (0.001 sec)
      

      May be related to: Comparison of JSON_EXTRACT result differs with Mysql.

        Attachments

          Activity

            People

            Assignee:
            rucha174 Rucha Deodhar
            Reporter:
            wchiquito William Chiquito
            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.