mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
MDEV-22976 CAST(JSON_EXTRACT() AS DECIMAL) does not handle boolean values
Item_func_json_extract did not implement val_decimal(),
so CAST(JSON_EXTRACT('{"x":true}', '$.x') AS DECIMAL) erroneously
returned 0 with a warning because of convertion from the string "true"
to decimal.
Implementing val_decimal(), so boolean values are correctly handled.
This commit is contained in:
@@ -540,6 +540,19 @@ SELECT JSON_MERGE_PATCH('{}');
|
||||
SELECT JSON_MERGE_PATCH('{', '[1,2,3]');
|
||||
SELECT JSON_MERGE_PATCH('{"a":"b"}', '[1,');
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-22976 CAST(JSON_EXTRACT() AS DECIMAL) does not handle boolean values
|
||||
--echo #
|
||||
|
||||
SELECT
|
||||
CAST(JSON_EXTRACT('{"x":true}', '$.x') AS DOUBLE) AS cf,
|
||||
CAST(JSON_EXTRACT('{"x":true}', '$.x') AS DECIMAL) AS cd;
|
||||
|
||||
SELECT
|
||||
CAST(JSON_EXTRACT('{"x":false}', '$.x') AS DOUBLE) AS cf,
|
||||
CAST(JSON_EXTRACT('{"x":false}', '$.x') AS DECIMAL) AS cd;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.2 tests
|
||||
--echo #
|
||||
|
||||
Reference in New Issue
Block a user