Details
-
Bug
-
Status: Confirmed (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.3.11, 10.2(EOL), 10.3(EOL)
-
None
Description
Hi, the scientific notation handling was partially fixed in MDEV-15561
But this still fails
MariaDB [(none)]> select json_extract('{"test":0e-10}','$.test') from dual;
|
+-----------------------------------------+
|
| json_extract('{"test":0e-10}','$.test') |
|
+-----------------------------------------+
|
| NULL |
|
+-----------------------------------------+
|
1 row in set, 1 warning (0.000 sec)
|
|
MariaDB [(none)]> select json_extract('{"test":0E-10}','$.test') from dual;
|
+-----------------------------------------+
|
| json_extract('{"test":0E-10}','$.test') |
|
+-----------------------------------------+
|
| NULL |
|
+-----------------------------------------+
|
1 row in set, 1 warning (0.000 sec)
|
|
MariaDB [(none)]> show warnings;
|
+---------+------+-----------------------------------------------------------------------------------+
|
| Level | Code | Message |
|
+---------+------+-----------------------------------------------------------------------------------+
|
| Warning | 4038 | Syntax error in JSON text in argument 1 to function 'json_extract' at position 10 |
|
+---------+------+-----------------------------------------------------------------------------------+
|
1 row in set (0.000 sec)
|
although this works
|
MariaDB [(none)]> select json_extract('{"test":1E-10}','$.test') from dual;
|
+-----------------------------------------+
|
| json_extract('{"test":1E-10}','$.test') |
|
+-----------------------------------------+
|
| 1E-10 |
|
+-----------------------------------------+
|
1 row in set (0.000 sec)
|
I know that the zero encoded in scientific notation seems to be strange, but it is just how one of the most used json library works by default.
When you use https://github.com/FasterXML/jackson and serialize java's BigDecimal that have set scale but it's value will be 0, it will by default serialize it this way.
This is what Oracle 18c returns
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
Version 18.3.0.0.0
SQL> select json_value('{"test":0E-10}','$.test') from dual;
JSON_VALUE('{"TEST":0E-10}','$.TEST')
--------------------------------------------------------------------------------
0