mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
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
This commit is contained in:
parent
843b414891
commit
ad647cc84e
4 changed files with 21 additions and 32 deletions
|
@ -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
|
||||||
#
|
#
|
||||||
|
|
|
@ -1061,9 +1061,7 @@ json_type(json_compact(3.14))
|
||||||
DOUBLE
|
DOUBLE
|
||||||
select json_type(json_compact(3.14E30));
|
select json_type(json_compact(3.14E30));
|
||||||
json_type(json_compact(3.14E30))
|
json_type(json_compact(3.14E30))
|
||||||
NULL
|
DOUBLE
|
||||||
Warnings:
|
|
||||||
Warning 4038 Syntax error in JSON text in argument 1 to function 'json_type' at position 7
|
|
||||||
select json_type(json_compact(cast('10101abcde' as binary)));
|
select json_type(json_compact(cast('10101abcde' as binary)));
|
||||||
json_type(json_compact(cast('10101abcde' as binary)))
|
json_type(json_compact(cast('10101abcde' as binary)))
|
||||||
INTEGER
|
INTEGER
|
||||||
|
@ -3445,52 +3443,34 @@ JSON_ARRAY(CASE WHEN 1 THEN NULL ELSE NULL END)
|
||||||
#
|
#
|
||||||
SELECT JSON_EXTRACT('-1E-36181012216111515851075235238', '$');
|
SELECT JSON_EXTRACT('-1E-36181012216111515851075235238', '$');
|
||||||
JSON_EXTRACT('-1E-36181012216111515851075235238', '$')
|
JSON_EXTRACT('-1E-36181012216111515851075235238', '$')
|
||||||
NULL
|
-1E-36181012216111515851075235238
|
||||||
Warnings:
|
|
||||||
Warning 4038 Syntax error in JSON text in argument 1 to function 'json_extract' at position 33
|
|
||||||
SELECT JSON_EXTRACT('1E-36181012216111515851075235238', '$');
|
SELECT JSON_EXTRACT('1E-36181012216111515851075235238', '$');
|
||||||
JSON_EXTRACT('1E-36181012216111515851075235238', '$')
|
JSON_EXTRACT('1E-36181012216111515851075235238', '$')
|
||||||
NULL
|
1E-36181012216111515851075235238
|
||||||
Warnings:
|
|
||||||
Warning 4038 Syntax error in JSON text in argument 1 to function 'json_extract' at position 32
|
|
||||||
SELECT JSON_EXTRACT('1E-325', '$');
|
SELECT JSON_EXTRACT('1E-325', '$');
|
||||||
JSON_EXTRACT('1E-325', '$')
|
JSON_EXTRACT('1E-325', '$')
|
||||||
NULL
|
1E-325
|
||||||
Warnings:
|
|
||||||
Warning 4038 Syntax error in JSON text in argument 1 to function 'json_extract' at position 6
|
|
||||||
SELECT JSON_EXTRACT('1E-324', '$');
|
SELECT JSON_EXTRACT('1E-324', '$');
|
||||||
JSON_EXTRACT('1E-324', '$')
|
JSON_EXTRACT('1E-324', '$')
|
||||||
NULL
|
1E-324
|
||||||
Warnings:
|
|
||||||
Warning 4038 Syntax error in JSON text in argument 1 to function 'json_extract' at position 6
|
|
||||||
SELECT JSON_EXTRACT('1E-323', '$');
|
SELECT JSON_EXTRACT('1E-323', '$');
|
||||||
JSON_EXTRACT('1E-323', '$')
|
JSON_EXTRACT('1E-323', '$')
|
||||||
NULL
|
1E-323
|
||||||
Warnings:
|
|
||||||
Warning 4038 Syntax error in JSON text in argument 1 to function 'json_extract' at position 6
|
|
||||||
SELECT JSON_EXTRACT('1E+308', '$');
|
SELECT JSON_EXTRACT('1E+308', '$');
|
||||||
JSON_EXTRACT('1E+308', '$')
|
JSON_EXTRACT('1E+308', '$')
|
||||||
NULL
|
1E+308
|
||||||
Warnings:
|
|
||||||
Warning 4038 Syntax error in JSON text in argument 1 to function 'json_extract' at position 6
|
|
||||||
error ER_INVALID_JSON_TEXT_IN_PARAM
|
error ER_INVALID_JSON_TEXT_IN_PARAM
|
||||||
SELECT JSON_EXTRACT('1E+309', '$');
|
SELECT JSON_EXTRACT('1E+309', '$');
|
||||||
JSON_EXTRACT('1E+309', '$')
|
JSON_EXTRACT('1E+309', '$')
|
||||||
NULL
|
1E+309
|
||||||
Warnings:
|
|
||||||
Warning 4038 Syntax error in JSON text in argument 1 to function 'json_extract' at position 6
|
|
||||||
error ER_INVALID_JSON_TEXT_IN_PARAM
|
error ER_INVALID_JSON_TEXT_IN_PARAM
|
||||||
SELECT JSON_EXTRACT('1E+36181012216111515851075235238', '$');
|
SELECT JSON_EXTRACT('1E+36181012216111515851075235238', '$');
|
||||||
JSON_EXTRACT('1E+36181012216111515851075235238', '$')
|
JSON_EXTRACT('1E+36181012216111515851075235238', '$')
|
||||||
NULL
|
1E+36181012216111515851075235238
|
||||||
Warnings:
|
|
||||||
Warning 4038 Syntax error in JSON text in argument 1 to function 'json_extract' at position 32
|
|
||||||
error ER_INVALID_JSON_TEXT_IN_PARAM
|
error ER_INVALID_JSON_TEXT_IN_PARAM
|
||||||
SELECT JSON_EXTRACT('-1E+36181012216111515851075235238', '$');
|
SELECT JSON_EXTRACT('-1E+36181012216111515851075235238', '$');
|
||||||
JSON_EXTRACT('-1E+36181012216111515851075235238', '$')
|
JSON_EXTRACT('-1E+36181012216111515851075235238', '$')
|
||||||
NULL
|
-1E+36181012216111515851075235238
|
||||||
Warnings:
|
|
||||||
Warning 4038 Syntax error in JSON text in argument 1 to function 'json_extract' at position 33
|
|
||||||
#
|
#
|
||||||
# Bug#21383284: ASSERTION IN SELECT_LEX::SETUP_CONDS
|
# Bug#21383284: ASSERTION IN SELECT_LEX::SETUP_CONDS
|
||||||
#
|
#
|
||||||
|
|
|
@ -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]=
|
||||||
/*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 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue