diff options
author | Alexander Barkov <bar@mariadb.com> | 2019-10-14 08:21:08 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2019-10-14 08:21:08 +0400 |
commit | 5392726e3c4f924745412500a7d1e030226a68d1 (patch) | |
tree | b4267ef4878509fad2ee7d98bce7e07a37ac7c85 /sql/item_func.h | |
parent | fa8437908ba55022d5f186d63dec4f01afb59746 (diff) | |
download | mariadb-git-5392726e3c4f924745412500a7d1e030226a68d1.tar.gz |
MDEV-20818 ER_CRASHED_ON_USAGE or Assertion `length <= column->length' failed in write_block_record on temporary table
The patch for `MDEV-20795 CAST(inet6 AS BINARY) returns wrong result`
unintentionally changed what Item_char_typecast::type_handler()
returns. This broke UNIONs with the BINARY() function, as the Aria
engine started to get columns of unexpected data types.
Restoring previous behaviour, to return
Type_handler::string_type_handler(max_length).
The prototype for Item_handed_func::return_type_handler() has changed
from:
const Type_handler *return_type_handler() const
to:
const Type_handler *return_type_handler(const Item_handled_func *) const
Diffstat (limited to 'sql/item_func.h')
-rw-r--r-- | sql/item_func.h | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/sql/item_func.h b/sql/item_func.h index 5b0093167d4..2525f6f1f0b 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -466,11 +466,12 @@ public: virtual longlong val_int(Item_handled_func *) const= 0; virtual my_decimal *val_decimal(Item_handled_func *, my_decimal *) const= 0; virtual bool get_date(THD *thd, Item_handled_func *, MYSQL_TIME *, date_mode_t fuzzydate) const= 0; - virtual const Type_handler *return_type_handler() const= 0; + virtual const Type_handler * + return_type_handler(const Item_handled_func *item) const= 0; virtual const Type_handler * type_handler_for_create_select(const Item_handled_func *item) const { - return return_type_handler(); + return return_type_handler(item); } virtual bool fix_length_and_dec(Item_handled_func *) const= 0; }; @@ -529,14 +530,14 @@ public: class Handler_temporal_string: public Handler_temporal { public: - const Type_handler *return_type_handler() const + const Type_handler *return_type_handler(const Item_handled_func *) const { return &type_handler_string; } const Type_handler * type_handler_for_create_select(const Item_handled_func *item) const { - return return_type_handler()->type_handler_for_tmp_table(item); + return return_type_handler(item)->type_handler_for_tmp_table(item); } double val_real(Item_handled_func *item) const { @@ -560,7 +561,7 @@ public: class Handler_date: public Handler_temporal { public: - const Type_handler *return_type_handler() const + const Type_handler *return_type_handler(const Item_handled_func *) const { return &type_handler_newdate; } @@ -591,7 +592,7 @@ public: class Handler_time: public Handler_temporal { public: - const Type_handler *return_type_handler() const + const Type_handler *return_type_handler(const Item_handled_func *) const { return &type_handler_time2; } @@ -617,7 +618,7 @@ public: class Handler_datetime: public Handler_temporal { public: - const Type_handler *return_type_handler() const + const Type_handler *return_type_handler(const Item_handled_func *) const { return &type_handler_datetime2; } @@ -653,7 +654,7 @@ public: } const Type_handler *type_handler() const { - return m_func_handler->return_type_handler(); + return m_func_handler->return_type_handler(this); } Field *create_field_for_create_select(MEM_ROOT *root, TABLE *table) { |