1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

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.
This commit is contained in:
Alexander Barkov
2018-05-31 18:52:32 +04:00
parent 3ceb4a54a1
commit ffe83e8e7b
15 changed files with 277 additions and 14 deletions

View File

@ -1125,6 +1125,7 @@ public:
virtual bool can_return_text() const { return true; }
virtual bool can_return_date() const { return true; }
virtual bool can_return_time() const { return true; }
virtual bool is_bool_type() const { return false; }
virtual bool is_general_purpose_string_type() const { return false; }
virtual uint Item_time_precision(Item *item) const;
virtual uint Item_datetime_precision(Item *item) const;
@ -2333,6 +2334,16 @@ public:
};
class Type_handler_bool: public Type_handler_long
{
static const Name m_name_bool;
public:
const Name name() const { return m_name_bool; }
bool is_bool_type() const { return true; }
bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *) const;
};
class Type_handler_longlong: public Type_handler_general_purpose_int
{
static const Name m_name_longlong;
@ -3615,6 +3626,7 @@ extern MYSQL_PLUGIN_IMPORT Type_handler_medium_blob type_handler_medium_blob;
extern MYSQL_PLUGIN_IMPORT Type_handler_long_blob type_handler_long_blob;
extern MYSQL_PLUGIN_IMPORT Type_handler_blob type_handler_blob;
extern MYSQL_PLUGIN_IMPORT Type_handler_bool type_handler_bool;
extern MYSQL_PLUGIN_IMPORT Type_handler_tiny type_handler_tiny;
extern MYSQL_PLUGIN_IMPORT Type_handler_short type_handler_short;
extern MYSQL_PLUGIN_IMPORT Type_handler_int24 type_handler_int24;