mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +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:
@ -916,5 +916,18 @@ NULL
|
||||
Warnings:
|
||||
Warning 4037 Unexpected end of JSON text in argument 2 to function 'json_merge_patch'
|
||||
#
|
||||
# MDEV-22976 CAST(JSON_EXTRACT() AS DECIMAL) does not handle boolean values
|
||||
#
|
||||
SELECT
|
||||
CAST(JSON_EXTRACT('{"x":true}', '$.x') AS DOUBLE) AS cf,
|
||||
CAST(JSON_EXTRACT('{"x":true}', '$.x') AS DECIMAL) AS cd;
|
||||
cf cd
|
||||
1 1
|
||||
SELECT
|
||||
CAST(JSON_EXTRACT('{"x":false}', '$.x') AS DOUBLE) AS cf,
|
||||
CAST(JSON_EXTRACT('{"x":false}', '$.x') AS DECIMAL) AS cd;
|
||||
cf cd
|
||||
0 0
|
||||
#
|
||||
# End of 10.2 tests
|
||||
#
|
||||
|
Reference in New Issue
Block a user