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

JSON_EXTRACT returns data for invalid JSON

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • 10.2.5
    • 10.2.9
    • JSON
    • None
    • Linux CentOS 6.4

    Description

      The function JSON_EXTRACT will return data and will not raise an error, even if the provided JSON is invalid JSON. It will not check the whole thing, so if the JSON up to the point of the provided JSON path is correct, that will be returned, even if the rest of the JSON data is invalid. For example

      MariaDB [(none)]> select JSON_EXTRACT('{"foo": "bar" foobar foo invalid ', '$.foo');
      +------------------------------------------------------------+
      | JSON_EXTRACT('{"foo": "bar" foobar foo invalid ', '$.foo') |
      +------------------------------------------------------------+
      | "bar"                                                      |
      +------------------------------------------------------------+
      1 row in set (0.00 sec)
      

      Attachments

        Activity

          People

            holyfoot Alexey Botchkov
            karlsson Anders Karlsson
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.