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

json_extract returns NULL with numbers in scientific notation

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.2.13, 10.2(EOL), 10.3(EOL)
    • 10.3.6
    • JSON
    • None
    • tested with MariaDB 10.2.13 on Debian 8
    • 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

            holyfoot Alexey Botchkov
            Richard Richard Stracke
            Votes:
            1 Vote for this issue
            Watchers:
            5 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.