Skip to content
/ server Public

Commit 635a850

Browse files
committed
MDEV-36888 Assertion `typeid(*copy) == typeid(*this)' in Item_func_or_sum::do_build_clone
Problems was in forgotten Item type in two places: clone and finding origin field. The handling added.
1 parent 7edf2dc commit 635a850

File tree

4 files changed

+24
-2
lines changed

4 files changed

+24
-2
lines changed

mysql-test/main/view.result

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7076,5 +7076,15 @@ ERROR 22007: Truncated incorrect DECIMAL value: ''
70767076
DROP VIEW v1;
70777077
DROP TABLE t1, t2;
70787078
#
7079-
# End of 10.6 tests
7079+
# MDEV-36888: Assertion `typeid(*copy) == typeid(*this)' in
7080+
# Item_func_or_sum::do_build_clone
70807081
#
7082+
CREATE TABLE t (a INT default 1);
7083+
INSERT INTO t VALUES (0),(2);
7084+
CREATE ALGORITHM=TEMPTABLE VIEW v AS SELECT * FROM t;
7085+
EXECUTE IMMEDIATE "SELECT * FROM v WHERE COERCIBILITY(VALUE(a)) > a";
7086+
a
7087+
0
7088+
drop view v;
7089+
drop table t;
7090+
# End of 10.6 tests

mysql-test/main/view.test

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6839,5 +6839,14 @@ DROP VIEW v1;
68396839
DROP TABLE t1, t2;
68406840

68416841
--echo #
6842-
--echo # End of 10.6 tests
6842+
--echo # MDEV-36888: Assertion `typeid(*copy) == typeid(*this)' in
6843+
--echo # Item_func_or_sum::do_build_clone
68436844
--echo #
6845+
CREATE TABLE t (a INT default 1);
6846+
INSERT INTO t VALUES (0),(2);
6847+
CREATE ALGORITHM=TEMPTABLE VIEW v AS SELECT * FROM t;
6848+
EXECUTE IMMEDIATE "SELECT * FROM v WHERE COERCIBILITY(VALUE(a)) > a";
6849+
drop view v;
6850+
drop table t;
6851+
6852+
--echo # End of 10.6 tests

sql/item.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8026,6 +8026,7 @@ Item *find_producing_item(Item *item, st_select_lex *sel)
80268026
{
80278027
DBUG_ASSERT(item->type() == Item::FIELD_ITEM ||
80288028
item->type() == Item::TRIGGER_FIELD_ITEM ||
8029+
item->type() == Item::INSERT_VALUE_ITEM ||
80298030
(item->type() == Item::REF_ITEM &&
80308031
((Item_ref *) item)->ref_type() == Item_ref::VIEW_REF));
80318032
Item_field *field_item= NULL;

sql/item.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7201,6 +7201,8 @@ class Item_insert_value : public Item_field
72017201
{
72027202
return mark_unsupported_function("value()", arg, VCOL_IMPOSSIBLE);
72037203
}
7204+
Item *do_get_copy(THD *thd) const override
7205+
{ return get_item_copy<Item_insert_value>(thd, this); }
72047206
};
72057207

72067208

0 commit comments

Comments
 (0)