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

json_extract returns NULL with numbers in scientific notation

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.2, 10.3, 10.2.13
    • Fix Version/s: 10.3.6
    • Component/s: JSON
    • Labels:
      None
    • Environment:
      tested with MariaDB 10.2.13 on Debian 8
    • Sprint:
      10.3.6-1

      Description

      json_extract returns NULL for a number in scientific notation.

      MariaDB [(none)]> select json_extract('{"test":8.437e-5}','$.test'); 
      +--------------------------------------------+
      | json_extract('{"test":8.437e-5}','$.test') |
      +--------------------------------------------+
      | NULL                                       |
      +--------------------------------------------+
      

      with the following warning

      MariaDB [(none)]> show warnings;
      +---------+------+----------------------------------------------------------------------------------+
      | Level   | Code | Message                                                                          |
      +---------+------+----------------------------------------------------------------------------------+
      | Warning | 4038 | Syntax error in JSON text in argument 1 to function 'json_extract' at position 8 |
      +---------+------+----------------------------------------------------------------------------------+
      
      

      json value works.

      +------------------------------------------+
      | json_value('{"test":8.437e-5}','$.test') |
      +------------------------------------------+
      | 8.437e-5                                 |
      +------------------------------------------+
      1 row in set (0.00 sec)
      
      

      json_valid returns true for the given document

      MariaDB [(none)]> select json_valid('{"test":8.437e-5}');
      +---------------------------------+
      | json_valid('{"test":8.437e-5}') |
      +---------------------------------+
      |                               1 |
      +---------------------------------+
      

        Attachments

          Activity

            People

            Assignee:
            holyfoot Alexey Botchkov
            Reporter:
            Richard Richard Stracke
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: