Skip to content

Commit ae02999

Browse files
committed
MDEV-34776 Assertion failure in Item_string::do_build_clone
Added missed methods to Item_string child.
1 parent fccfdc2 commit ae02999

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

mysql-test/main/item_types.result

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,12 @@ SELECT * FROM t WHERE a=b'';
3535
a
3636
drop view t;
3737
#
38+
# MDEV-34776: Assertion failure in Item_string::do_build_clone
39+
#
40+
CREATE VIEW v AS SELECT version() AS f;
41+
SELECT * FROM v WHERE f = '10.5.20';
42+
f
43+
drop view v;
44+
#
3845
# End of 10.5 tests
3946
#

mysql-test/main/item_types.test

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ CREATE VIEW t AS SELECT 1 AS a;
3838
SELECT * FROM t WHERE a=b'';
3939
drop view t;
4040

41+
--echo #
42+
--echo # MDEV-34776: Assertion failure in Item_string::do_build_clone
43+
--echo #
44+
45+
CREATE VIEW v AS SELECT version() AS f;
46+
SELECT * FROM v WHERE f = '10.5.20';
47+
drop view v;
48+
4149
--echo #
4250
--echo # End of 10.5 tests
4351
--echo #

sql/item.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4719,6 +4719,9 @@ class Item_string_sys :public Item_string
47194719
Item_string_sys(THD *thd, const char *str):
47204720
Item_string(thd, str, (uint) strlen(str), system_charset_info)
47214721
{ }
4722+
Item *do_get_copy(THD *thd) const override
4723+
{ return get_item_copy<Item_string_sys>(thd, this); }
4724+
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
47224725
};
47234726

47244727

@@ -4733,6 +4736,9 @@ class Item_string_ascii :public Item_string
47334736
Item_string(thd, str, (uint) strlen(str), &my_charset_latin1,
47344737
DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII)
47354738
{ }
4739+
Item *do_get_copy(THD *thd) const override
4740+
{ return get_item_copy<Item_string_ascii>(thd, this); }
4741+
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
47364742
};
47374743

47384744

@@ -4769,6 +4775,9 @@ class Item_static_string_func :public Item_string
47694775
// require fix_fields() to be re-run for every statement.
47704776
return mark_unsupported_function(func_name.str, arg, VCOL_TIME_FUNC);
47714777
}
4778+
Item *do_get_copy(THD *thd) const override
4779+
{ return get_item_copy<Item_static_string_func>(thd, this); }
4780+
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
47724781
};
47734782

47744783

@@ -4786,6 +4795,9 @@ class Item_partition_func_safe_string: public Item_string
47864795
{
47874796
return mark_unsupported_function("safe_string", arg, VCOL_IMPOSSIBLE);
47884797
}
4798+
Item *do_get_copy(THD *thd) const override
4799+
{ return get_item_copy<Item_partition_func_safe_string>(thd, this); }
4800+
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
47894801
};
47904802

47914803

0 commit comments

Comments
 (0)