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

JSON_EXTRACT returns data for invalid JSON

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 10.2.5
    • Fix Version/s: 10.2.9
    • Component/s: JSON
    • Labels:
      None
    • Environment:
      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

            Assignee:
            holyfoot Alexey Botchkov
            Reporter:
            karlsson Anders Karlsson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: