diff --git a/mysql-test/main/item_types.result b/mysql-test/main/item_types.result index 6a73549a886..0193d33be6d 100644 --- a/mysql-test/main/item_types.result +++ b/mysql-test/main/item_types.result @@ -35,5 +35,12 @@ SELECT * FROM t WHERE a=b''; a drop view t; # +# MDEV-34776: Assertion failure in Item_string::do_build_clone +# +CREATE VIEW v AS SELECT version() AS f; +SELECT * FROM v WHERE f = '10.5.20'; +f +drop view v; +# # End of 10.5 tests # diff --git a/mysql-test/main/item_types.test b/mysql-test/main/item_types.test index 56af975df9d..2818ae582af 100644 --- a/mysql-test/main/item_types.test +++ b/mysql-test/main/item_types.test @@ -38,6 +38,14 @@ CREATE VIEW t AS SELECT 1 AS a; SELECT * FROM t WHERE a=b''; drop view t; +--echo # +--echo # MDEV-34776: Assertion failure in Item_string::do_build_clone +--echo # + +CREATE VIEW v AS SELECT version() AS f; +SELECT * FROM v WHERE f = '10.5.20'; +drop view v; + --echo # --echo # End of 10.5 tests --echo # diff --git a/sql/item.h b/sql/item.h index f5ef54382cb..cddef65f4fd 100644 --- a/sql/item.h +++ b/sql/item.h @@ -4719,6 +4719,9 @@ public: Item_string_sys(THD *thd, const char *str): Item_string(thd, str, (uint) strlen(str), system_charset_info) { } + Item *do_get_copy(THD *thd) const override + { return get_item_copy(thd, this); } + Item *do_build_clone(THD *thd) const override { return get_copy(thd); } }; @@ -4733,6 +4736,9 @@ public: Item_string(thd, str, (uint) strlen(str), &my_charset_latin1, DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII) { } + Item *do_get_copy(THD *thd) const override + { return get_item_copy(thd, this); } + Item *do_build_clone(THD *thd) const override { return get_copy(thd); } }; @@ -4769,6 +4775,9 @@ public: // require fix_fields() to be re-run for every statement. return mark_unsupported_function(func_name.str, arg, VCOL_TIME_FUNC); } + Item *do_get_copy(THD *thd) const override + { return get_item_copy(thd, this); } + Item *do_build_clone(THD *thd) const override { return get_copy(thd); } }; @@ -4786,6 +4795,9 @@ public: { return mark_unsupported_function("safe_string", arg, VCOL_IMPOSSIBLE); } + Item *do_get_copy(THD *thd) const override + { return get_item_copy(thd, this); } + Item *do_build_clone(THD *thd) const override { return get_copy(thd); } };