summaryrefslogtreecommitdiff
path: root/sql/item_xmlfunc.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2018-05-31 18:52:32 +0400
committerAlexander Barkov <bar@mariadb.com>2018-05-31 18:52:32 +0400
commitffe83e8e7bef32eb2a80aad2d382f0b023dd3a44 (patch)
tree065bfa8c2afb2dcb2096e40d18c2e56a61eae47f /sql/item_xmlfunc.cc
parent3ceb4a54a178d3e92529b4be16e866e18fd15218 (diff)
downloadmariadb-git-ffe83e8e7bef32eb2a80aad2d382f0b023dd3a44.tar.gz
MDEV-16351 JSON_OBJECT() treats hybrid functions with boolean arguments as numbers
Now the boolean data type is preserved in hybrid functions and MIN/MAX, so COALESCE(bool_expr,bool_expr) and MAX(bool_expr) are correctly detected by JSON_OBJECT() as being boolean rather than numeric expressions.
Diffstat (limited to 'sql/item_xmlfunc.cc')
-rw-r--r--sql/item_xmlfunc.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc
index ab41b496cde..a4221661ae4 100644
--- a/sql/item_xmlfunc.cc
+++ b/sql/item_xmlfunc.cc
@@ -855,7 +855,9 @@ String *Item_nodeset_func_elementbyindex::val_nodeset(String *nodeset)
flt->pos,
size);
int index= (int) (args[1]->val_int()) - 1;
- if (index >= 0 && (flt->pos == (uint) index || args[1]->is_bool_type()))
+ if (index >= 0 &&
+ (flt->pos == (uint) index ||
+ (args[1]->type_handler()->is_bool_type())))
((XPathFilter*)nodeset)->append_element(flt->num, pos++);
}
return nodeset;
@@ -1803,7 +1805,8 @@ my_xpath_parse_AxisSpecifier_NodeTest_opt_Predicate_list(MY_XPATH *xpath)
xpath->item= nodeset2bool(xpath, xpath->item);
- if (xpath->item->is_bool_type())
+ const Type_handler *fh;
+ if ((fh= xpath->item->fixed_type_handler()) && fh->is_bool_type())
{
xpath->context= new (xpath->thd->mem_root)
Item_nodeset_func_predicate(xpath->thd, prev_context,