Commit ad647cc8 authored by Alexey Botchkov's avatar Alexey Botchkov

MDEV-15561 json_extract returns NULL with numbers in scientific notation.

Scientific notation handling fixed.

Conflicts:
	mysql-test/r/func_json.result
	mysql-test/t/func_json.test
parent 843b4148
...@@ -736,6 +736,9 @@ insert into t1 values (2),(1); ...@@ -736,6 +736,9 @@ insert into t1 values (2),(1);
select 1 from t1 where json_extract(a,'$','$[81]'); select 1 from t1 where json_extract(a,'$','$[81]');
1 1
drop table t1; drop table t1;
select json_extract('{"test":8.437e-5}','$.test');
json_extract('{"test":8.437e-5}','$.test')
8.437e-5
# #
# Start of 10.3 tests # Start of 10.3 tests
# #
......
...@@ -391,6 +391,12 @@ insert into t1 values (2),(1); ...@@ -391,6 +391,12 @@ insert into t1 values (2),(1);
select 1 from t1 where json_extract(a,'$','$[81]'); select 1 from t1 where json_extract(a,'$','$[81]');
drop table t1; drop table t1;
#
# MDEV-15561 json_extract returns NULL with numbers in scientific notation.
#
select json_extract('{"test":8.437e-5}','$.test');
--echo # --echo #
--echo # Start of 10.3 tests --echo # Start of 10.3 tests
--echo # --echo #
......
...@@ -473,8 +473,8 @@ static int json_num_states[NS_NUM_STATES][N_NUM_CLASSES]= ...@@ -473,8 +473,8 @@ static int json_num_states[NS_NUM_STATES][N_NUM_CLASSES]=
/*ZE1*/ { JE_SYN, JE_SYN, JE_SYN, JE_SYN, NS_FRAC, JE_SYN, NS_OK, JE_BAD_CHR }, /*ZE1*/ { JE_SYN, JE_SYN, JE_SYN, JE_SYN, NS_FRAC, JE_SYN, NS_OK, JE_BAD_CHR },
/*INT*/ { JE_SYN, JE_SYN, NS_INT, NS_INT, NS_FRAC, NS_EX, NS_OK, JE_BAD_CHR }, /*INT*/ { JE_SYN, JE_SYN, NS_INT, NS_INT, NS_FRAC, NS_EX, NS_OK, JE_BAD_CHR },
/*FRAC*/ { JE_SYN, JE_SYN, NS_FRAC, NS_FRAC,JE_SYN, NS_EX, NS_OK, JE_BAD_CHR }, /*FRAC*/ { JE_SYN, JE_SYN, NS_FRAC, NS_FRAC,JE_SYN, NS_EX, NS_OK, JE_BAD_CHR },
/*EX*/ { NS_EX1, NS_EX1, NS_EX1, NS_EX1, JE_SYN, JE_SYN, JE_SYN, JE_BAD_CHR }, /*EX*/ { NS_EX, NS_EX, NS_EX1, NS_EX1, JE_SYN, JE_SYN, JE_SYN, JE_BAD_CHR },
/*EX1*/ { JE_SYN, JE_SYN, NS_EX1, NS_EX1, JE_SYN, JE_SYN, JE_SYN, JE_BAD_CHR } /*EX1*/ { JE_SYN, JE_SYN, NS_EX1, NS_EX1, JE_SYN, JE_SYN, NS_OK, JE_BAD_CHR }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment