1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +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:
Alexander Barkov
2020-06-22 15:43:53 +04:00
parent 009ef36d9a
commit 30903c3743
4 changed files with 62 additions and 0 deletions

View File

@ -171,6 +171,7 @@ public:
String *val_str(String *);
longlong val_int();
double val_real();
my_decimal *val_decimal(my_decimal *);
uint get_n_paths() const { return arg_count - 1; }
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
{ return get_item_copy<Item_func_json_extract>(thd, mem_root, this); }